Skip to contents

Low-level function that sends a request to any FRED API endpoint and returns the parsed JSON as a list. Most users should use the higher-level functions such as fred_series() or fred_search().

Usage

fred_request(endpoint, ...)

Arguments

endpoint

Character. The API endpoint path (e.g. "series/observations").

...

Named parameters passed as query string arguments to the API.

Value

A list parsed from the JSON response.

Examples

# \donttest{
op <- options(fred.cache_dir = tempdir())
fred_request("series", series_id = "GDP")
#> Error in fred_get_key(): No FRED API key found.
#>  Set one with `fred_set_key()` or the `FRED_API_KEY` environment variable.
#>  Register for a free key at <https://fredaccount.stlouisfed.org/apikeys>.
options(op)
# }