Authentication setup
To use the API, we need to have a valid email and API key with the EPA website. Getting an API key is easy, and can be done following the instructions here. Once we have the email and key, we can easily set these up to be in our requests.
authentication <- create.authentication("youremail@domain.com", "yourAPIkey")
options(epa_authentication = authentication)
This sets your authentication info to be in your .Rprofile options to make calls. All future data requests will now use these credentials.
Checking if the API is running
All queries automatically check if the API is running. It might make sense, however, to check the API is up before making multiple queries. The package allows you to make this check easily.
is.API.running()
## [1] "API service is up and running healthy. Status: connection_pool: size: 5, connections: 1, in use: 1, waiting_in_queue: 0"
## [1] "2020-07-03T17:20:41-04:00"