A Reference Class to represent an pxweb_api
apiThe name of the api (api domain)
descriptionShort description of the pxweb api.
urlAn url template for the pxweb api.
versionsA character vector with versions of the api.
languagesA character vector with languages of the api.
calls_per_periodThe number of allowed calls per period.
period_in_secondsThe length of the period with allowed calls.
max_values_to_downloadMaximum number of values to download with each call.
base_url(version = NULL, language = NULL)Create a base url from the api for version and language. The first element of versions and languages is used as standard.
check_alt(version = NULL, language = NULL)Check if the version/language alternative exist in the object.
check_input()Check the consistency of the fields.
get_api(api_name)Get the api configuration from inst/extdata/api.json for the api_name.
initialize(get_api = NULL, ...)Create a new pxweb_api object.
pxweb_api_to_list()Create a list of the current pxweb_api object
test_api(test_type = "fast", seed = as.integer(Sys.time()))Test to connect to the api and download for each api version/language.
:param test_type: c("fast", "sample", "full").
"fast" check that one random datapoint can be downloaded from each api
"sample" check that one random datapoint can be downloaded from each node
"full" check that all datapoints can be downloaded
:param seed: seed to use for random choice of data points.
write_to_catalogue()Save/overwrite the current api as a locally stored api.
# NOT RUN {
scb_pxweb_api <- pxweb_api$new(get_api = "api.scb.se")
scb_pxweb_api
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab