Skip to contents

Returns the address requests to name will actually be sent to. This is how you confirm a region took effect: packages declare one address per region in .onLoad, and the region picks between them when the URL is read, so it does not matter whether the region was set before or after the package loaded.

Errors when the API has no address in the current region, naming the package that must supply one. That is not pedantry: falling back to another region's host would send the request out of the country and succeed, which is worse than failing.

Usage

api_url(name)

Arguments

name

String. Name of a registered API.

Value

String. The resolved URL.

See also

add_api() to register an API, auth_status() to see the session's region

Examples

if (FALSE) { # \dontrun{
api_url("counts")
#> "https://counts.spdgt.com/api"

Sys.setenv(SPDGT_REGION = "ca")
api_url("counts")
#> "https://counts.ca.spdgt.com/api"
} # }