| APIKeys | R Documentation |
This package maintains an internal set of API keys which
users can set using setAPIKey(). These keys will be remembered for
the duration of an R session. In functions that accept an API key argument,
if the passed in API key is NULL, code will look up an appropriate
named API key to see if that key has been set globally. Setting keys globally
is a convenience that simplifies scripts written by end users.
Currently supported API keys include:
"PurpleAir-read" – PurpleAir API_READ_KEY
"PurpleAir-write" – PurpleAir API_WRITE_KEY
"Clarity-read" – Clarity API_READ_KEY
provider |
Character string used to identify an API key. Used as the
first argument to |
key |
Character API key. Used as the second argument to |
Three API key support functions are imported from the MazamaCoreUtils package where they are described in more detail:
MazamaCoreUtils::getAPIKey
MazamaCoreUtils::setAPIKey
MazamaCoreUtils::showAPIKeys
An API key string or a list of provider:key pairs.
library(AirSensor2)
# Start out with no keys (unless the user has set them)
showAPIKeys()
getAPIKey("PurpleAir-read")
# Set specific keys
setAPIKey("PurpleAir-read", "********-2A00-11EB-A8CD-42010A800126")
setAPIKey("PurpleAir-write", "********-2A00-11EB-A8CD-42010A800126")
showAPIKeys()
getAPIKey("PurpleAir-read")
# Reset the read key
setAPIKey("PurpleAir-read", NULL)
showAPIKeys()
getAPIKey("PurpleAir-read")
# Reset the write key
setAPIKey("PurpleAir-write", NULL)
showAPIKeys()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.