| query_url | R Documentation |
PX-Web API query URL
query_url(
url_or_tableid,
...,
url_type = "ssb",
use_index = FALSE,
default_query = c(1, -2, -1)
)
url_or_tableid |
A table id, a PxWebApi v2 URL to data or metadata, or metadata returned by
|
... |
Specification of query for each variable. See ‘Details’ in |
url_type |
Currently two possibilities: "ssb" (Norwegian) or "ssb_en" (English). |
use_index |
Logical. If TRUE, numeric values are matched against the |
default_query |
Specification for variables not included in |
The option PxWebApiData.MAX_URL_CHARS sets the threshold for issuing a
warning when generated URLs are long. When unset, 2100 is used as a default,
following the GET limit documented for PxWebApi v2.
URLs longer than this may fail (typically returning HTTP 404). The option does not affect the URL or the request itself.
The threshold can be changed by the user, for example:
options(PxWebApiData.MAX_URL_CHARS = 3000).
A PxWeb API URL to data, with query parameters added according to the input.
query_url(4861,
Region = FALSE,
ContentsCode = "Bosatte",
Tid = c(1, 5, -1),
url_type = "ssb_en")
query_url("https://data.ssb.no/api/pxwebapi/v2/tables/08991/data?lang=en",
Fangst2 = FALSE,
Elver = FALSE,
ContentsCode = TRUE, # same as "*"
Tid = "top(5)") # same as 5i
query_url("https://data.ssb.no/api/pxwebapi/v2/tables/07459/data?lang=en",
Region = FALSE,
Kjonn = TRUE,
Alder = list(codelist = "agg_TodeltGrupperingB",
valueCodes = c("H17", "H18"),
outputValues = "aggregated"),
ContentsCode = 1,
Tid = 4i)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.