set_key: Set Key

View source: R/google_keys.R

set_keyR Documentation

Set Key

Description

Sets an API key so it's available for all API calls. See details

Usage

set_key(
  key,
  api = c("default", "map", "directions", "distance", "elevation", "geocode", "places",
    "find_place", "place_autocomplete", "places_details", "roads", "streetview",
    "timezone")
)

Arguments

key

Google API key

api

The api for which the key applies. If NULL, the api_key is assumed to apply to all APIs

Details

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.

Examples


## 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")



googleway documentation built on Aug. 22, 2023, 9:13 a.m.