Welcome to TERN Knowledge Base

How to download TERN's acoustic data in bulk using APIs

If you need to download a small number of audio files from https://data.tern.org.au/ecoacoustics/ right click on the file and select Save Link As…

If you want to download a large number of files, we recommend using an API key and the WGET command line tool. These instructions will guide you through the process step by step.

Generate the API key

To generate an API Key, please visit the TERN Account portal at (https://account.tern.org.au) and Sign In. After signing in, follow the steps below.

  • In the menu on the left, click Create API key menu link (1)

  • Enter the name of the API key in the API key name field (can be arbitrary, for your records - but it's mandatory) (2)

  • Click the button Request API Key (3)

  • Copy the generated API key in the API key field (4)

Figure 1

Figure 2

After generating the API key, copy it (e.g. in Notepad) and store it in a secure place. Note: The API key is only displayed once in the API key Information page. For security reasons, it will not be shown or accessible afterwards. If you lose your API key, you need to generate a new one.

Install WGET

To download the data in bulk, you will be using the wget command line tool in PowerShell.

  • PowerShell is a command line shell that allows you to run scripts. To find it, you can use the search field near the Start icon in the bottom left of your computer.

Figure 3

  • Click on the PowerShell App.

  • This will open the command window.

Figure 4

Please note that, in the example above, the part underlined in red identifies the local directory where PowerShell “is” at the moment. In this example, PowerShell is in C: > Users > uqegirol. uqegirol is my user name directory on my computer. Yours will be different.

  • Type wget.exe -V (or wget --version if you are on a Mac) and press Enter.

Figure 5

  • If the WGET tool is already installed you will see an output as shown below in Figure 6. In this case, you can skip to the following step (Change directory).

Figure 6

Change directory

You can select where the data will be saved on your computer by changing the directory in PowerShell. If you are downloading a large amount of data, you may want to use an external hard drive.

  • In PowerShell type cd followed by the file path for the directory where you want to save the data. e.g. in this example, the data will be saved on my external hard drive, which is connected to my port E.

Figure 7

In this example, I am using the Document folder on my laptop.

Figure 8

Downloading the data

  • Copy the following command into a text editor, e.g. Notepad. It will be easier to edit it and save it for future reference.

  • Note: if you are on Windows use wget.exe. If you are on Mac use wget.

wget.exe --mirror -np -e robots=off --user='<apikey>' --password='' https://data.tern.org.au/ecoacoustics/Calperum/Calperum01/2013/

  • Substitute <apikey> with your API key. It needs to be within single quotation marks. For example,

wget.exe --mirror -np -e robots=off --user='MEN0aHJtSzZFd0FCTlZNMC5yd0BJaXY/bQlxOCE+Qn' --password='' https://data.tern.org.au/ecoacoustics/Calperum/Calperum01/audio_files/2013/

  • Make sure the password is blank.

  • Substitute Calperum/Calperum01/audio_files/2013/ with the folder (or file) that you want to download. e.g:

wget.exe --mirror -np -e robots=off --user='<apikey>' --password='' https://data.tern.org.au/ecoacoustics/RobsonCreek/RobsonCreek01/audio_files/2012/04/fnqr_robson-FNQ1-RBS_20120403_140000.flac

Please note that using:

  • wget.exe --mirror -np -e robots=off --user='<apikey>' --password='' https://data.tern.org.au/ecoacoustics/RobsonCreek/RobsonCreek01/audio_files/will download all files from Robson Creek sensor 01.

  • wget.exe --mirror -np -e robots=off --user='<apikey>' --password='' https://data.tern.org.au/ecoacoustics/RobsonCreek/RobsonCreek01/audio_files/2012/will download all files from Robson Creek sensor 01 from the year 2012

  • wget.exe --mirror -np -e robots=off --user='<apikey>' --password='' https://data.tern.org.au/ecoacoustics/RobsonCreek/RobsonCreek01/audio_files/2012/04/will download all files from Robson Creek sensor 01 from April 2012

  • wget.exe --mirror -np -e robots=off --user='<apikey>' --password='' https://data.tern.org.au/ecoacoustics/RobsonCreek/RobsonCreek01/audio_files/2012/04/fnqr_robson-FNQ1-RBS_20120403_140000.flacwill download only one file. We recommend, trying this option first to test the process.

  • Once you have modified your script, copy and paste it into PowerShell and press enter. PowerShell will show you the download progress (see figure 9).

Figure 9

  • Once the download is complete, navigate to the directory where you have saved your files. You should see the folder data.tern.org.au. Your files have been saved here.

Figure 10

 

Provide your feedback about the experience with Knowledge base