bls_request: Retrieve Data From the U.S. Bureau Of Labor Statistics API v2

View source: R/bls_request.R

bls_requestR Documentation

Retrieve Data From the U.S. Bureau Of Labor Statistics API v2

Description

bls_request() will execute queries against the BLS API. Queries are generated using one of the following query-generating functions: query_series(), query_n_series(), query_popular_series(), query_all_surveys(), query_survey_info(), query_latest_observation(). The result is the "Results" block as defined in the API v2 signatures at https://www.bls.gov/developers/api_signature_v2.htm

Usage

bls_request(
  query,
  api_key = bls_get_key(),
  user_agent = "http://github.com/groditi/blsR",
  process_response = .process_response,
  ...
)

Arguments

query

list generated by one of the query generating functions

api_key

Optional. An API key string. Defaults to the value returned by bls_get_key(). The preferred way to provide an API key is to use bls_set_key() or the BLS_API_KEY environment variable. Manually passing the key will be deprecated in future releases.

user_agent

string, optional

process_response

function, optional. processes the httr response object. The default function will return the JSON payload parsed into a list

...

further arguments will be passed to process_response when called

Value

a list of information returned by the API request

See Also

Other blsR-requests: get_all_surveys(), get_latest_observation(), get_n_series_table(), get_n_series(), get_popular_series(), get_series_tables(), get_series_table(), get_series(), get_survey_info(), reduce_spanned_responses(), span_series_request()

Examples

## Not run: 
library(blsR)
uer_query <- query_series('LNS14000000') #monthly unemployment rate series
uer_results <- bls_request(uer_query) #API response

## End(Not run)

blsR documentation built on July 9, 2023, 5:29 p.m.