get_key: Retrieves the API key

View source: R/utility.r

get_keyR Documentation

Retrieves the API key

Description

get_key stops execution and returns an error message if the environment variable CN_API is not set to the user's API key. If the environment variable is not set, the function returns an error message.

Usage

get_key()

Value

The user's API key, if set as an environment variable. If key is not set, returns an error message indicating that the user can either set the environment variable CN_API or pass the API key as an argument to the function.

References

Note that this function is based on, and repeats much of the code in the R API package best practices, available at https://httr.r-lib.org/articles/api-packages.html#overall-design-1.

Examples

## Not run: 
get_key()

## End(Not run)

nutrientr documentation built on March 18, 2022, 6:27 p.m.