This page documents more advanced features for data queries. It is recommended to read first the page API data query.
This is the SDMX 2.1 REST request for data:
https://<api_base_uri>/sdmx/2.1/<resource>/<flowRef>/<key>?<parameters> |
Each section of this page discusses further the filters that can be set in this syntax definition.
SDMX 2.1 - REST - Data filtering on dimension
Request |
The key is constructed as a dot ('.') separated list of dimension filtered values.
To build the key:
Get the list of dataflows to identify a relevant dataflow.
Then download the data structure with references resolution for children for the relevant dataflow and check the list of dimensions.
Each dimension supports values set by the codelist definition.
For example, the data structure definition for NAMA_10_GDP lists 4 dimensions, in this order:
FREQ with values set by codelist FREQ
UNIT with values set by codelist UNIT
INDIC_NA with values set by codelist INDIC_NA
GEO with values set by codelist GEO
For NAMA_10_GDP the key [FREQ].[UNIT].[INDIC_NA].[GEO] in the exact order of dimensions set by the data structure definition can be for instance A.CP_MEUR.B1GQ.LU, where:
Position | 1 | 2 | 3 | 4 |
---|---|---|---|---|
Dimension | FREQ | UNIT | INDIC_NA | GEO |
Key value | A | CP_MEUR | B1GQ | LU |
Meaning | Data aggregated annually | Current prices, million euro | Gross domestic product at market prices | Luxembourg |
Dimensions which should not be filtered are left empty in the query. For NAMA_10_GDP the key without filter on dimension FREQ can be .CP_MEUR.B1GQ.LU
Logical conjuction is created using the plus '+' character. For NAMA_10_GDP the key can be A.CP_MEUR.B1GQ.BE+LU
SDMX 2.1 - REST - Data filtering on time
This allows filtering data observations within a time series on start and end dates.
Request |
The start and end of the time period in the filter are determined as startPeriod and endPeriod. Following time periods are supported:
Period | Format |
---|---|
Annual | YYYY-A1 or YYYY |
Semester | YYYY-S[1-2] |
Quarter | YYYY-Q[1-4] |
Monthly | YYYY-M[01-12] or YYYY-[01-12] |
Weekly | YYYY-W[01-53] |
Daily | YYYY-D[001-366] |
Year interval | YYYY/P[01-99]Y |
as illustrated by
Filtering on NAMA_10_GDP annual observations from 2012 to 2015 |
SDMX 2.1 - REST - Data filtering on first N and last N observations
This allows filtering data observations within a time series to limit the number of observations returned.
Request |
This filter may be applied to data which has been filtered by dimension and / or time.
First N Observations return the first N observations in the corresponding series
Last N Observations return the last N observations in the corresponding series
Both definitions may be applied e.g. to return the first and last observations in a series.
If the filter is wrong, then a response is returned with no observation results.
Filtering on NAMA_10_GDP for the last 5 annual observations |
SDMX 2.1 - REST - Data details
Request |
as illustrated by
NAMA_10_GDP with data only |