#' Register an API key to make requests
#'
#' Saves an RDS file in the current working directory to store API credentials.
#' All API-dependent functions will fail until you have done this.
#' Register for a personal API key here: https://admiraltyapi.portal.azure-api.net/
#'
#' @param api_key a valid Admirality API Key
#' @export
save_api_key <- function(api_key) {
readr::write_rds(api_key, "api_key")
}
read_api_key <- function(){
readr::read_rds("api_key")
}
check_saved_api_key <- function(){
if(!file.exists("api_key")){
stop("No saved API key found. Before requesting data use save_api_key()")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.