BlsData.Bls
— TypeA connection to the BLS API.
Constructors
Bls()
Bls(key::AbstractString)
Arguments
key
: Registration key provided by the BLS.
Methods
api_url(b::Bls)
: Get the base URL used to connect to the serverset_api_url!(b::Bls, url::AbstractString)
: Set the base URL used to connect to the serverapi_key(b::Bls)
: Get the API keyapi_version(b::Bls)
: Get the API version (v1 or v2) usedrequests_made(b::Bls)
: Get the number of requests made todayrequests_remaining(b::Bls)
: Get the number of requests remaining today
Notes
- A default API key can be specified in a ~/.blsdatarc file.
- A valid registration key increases the allowable number of requests per day as well making catalog metadata available.
BlsData.BlsSeries
— TypeA time series with metadata returned from a get_data
call.
For a series s
, access fields with
s.id
s.data
s.catalog
BlsData.get_data
— Methodget_data(b, series [; startyear, endyear, catalog])
Request one or multiple series using the BLS API.
Arguments
b
: ABls
connectionseries
: A string, or array of strings, identifying the time seriesstartyear
: A four-digit year identifying the start of the data request. Defaults to 9 or 19 years beforeendyear
, depending on the API version used.endyear
: A four-digit year identifying the end of the data request. Defaults to 9 or 19 years afterendyear
, depending on the API version used; or, this year, if neitherstartyear
norendyear
is provided.catalog
: Whether to return any available metadata about the series. Defaults tofalse
.
Returns
A BlsSeries
, or an array of BlsSeries
.