Set up credentials

To obtain an Auth0 token, you need to first store your WildTrax username and password as environment variables.

# Note that you need to use 'WT_USERNAME' and 'WT_PASSWORD'.

Sys.setenv(WT_USERNAME = 'guest', WT_PASSWORD = 'Apple123')


Next, you use the wt_auth() function to authenticate.

# Authenticate


The Auth0 token you obtained will last for 8 hours. After that time, you will need to re-authenticate.

Making API calls

Once authenticated, you can now use various functions that call upon the WildTrax API. For instance, you can use wt_get_download_summary() to see basic metadata about projects that you can download data for.

#Download the project summary you have access to
my_projects <- wt_get_download_summary(sensor_id = 'ARU')

my projects

Using the project_id number in the download summary you can then use wt_download_report to access the species data. You can also find the project_id number in the url of a WildTrax project, e.g.

#Download the project report
my_report <- wt_download_report(project_id = 47, sensor_id = 'ARU', cols_def = F, weather_cols = T)