The International Union for Conservation of Nature (IUCN) provides an API to access data from Red List of Threatened Species. This function checks whether data can be accessed from the API. Please note that a token is required to access the API (see below for instructions to obtain a token).
Arguments
- key
character
Token for querying the IUCN Red List API. Defaults toNULL
such that the token accessed from the"IUCN_REDLIST_KEY"
environmental variable (which can be specified in the .Renviron file).- n
integer
Number of times to attempt to access the API.
Accessing the IUCN Red List API
You will need to obtain a token for the
IUCN Red List API (if you do not have one
already). To achieve this, please visit the IUCN API website
(https://apiv3.iucnredlist.org/), click the "Generate a token" link at the
top of the web page, and fill out the form to apply for a token.
You should then receive a token shortly after completing
the form (but not immediately). After receiving a token, please open the
.Renviron
file on your computer (e.g., using usethis::edit_r_environ()
).
Next, please add the following text to the file (replacing the string with
the token) and save the file:
Please restart your R session. You should now be able to access the IUCN Red
List API. To verify this, please try running the following R code and --
assuming everything works correctly -- you should see TRUE
as the output:
If these instructions did not work, please consult the documentation for the rredlist package for further details.