set_key | R Documentation |
Sets an API key so it's available for all API calls. See details
set_key(
key,
api = c("default", "map", "directions", "distance", "elevation", "geocode", "places",
"find_place", "place_autocomplete", "places_details", "roads", "streetview",
"timezone")
)
key |
Google API key |
api |
The api for which the key applies. If NULL, the |
Use set_key
to make API keys available for all the google_
functions, so you don't need to specify the key
parameter within those
functions (for example, see google_directions).
The api
argument is useful if you use a different API key to access
different APIs. If you just use one API key to access all the APIs,
there is no need to specify the api
parameter, the default value api_key
will be used.
## not specifying 'api' will add the key to the 'api_key' list element
set_key(key = "xxx_your_api_key_xxx")
## api key for directions
set_key(key = "xxx_your_api_key_xxx", api = "directions")
## api key for maps
set_key(key = "xxx_your_api_key_xxx", api = "map")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.