The URL a registered API resolves to
api_url.RdReturns 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.
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"
} # }