Child pages
  • API SDMX 2.1 - data filtering

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

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.

Anchor
SDMX21FDIM
SDMX21FDIM
SDMX 2.1 - REST - Data filtering on dimension

Request
https://<api_base_uri>/sdmx/2.1/<resource>/<flowRef>/<key>

The key is constructed as a dot ('.') separated list of dimension filtered values.

To build the key:

Position

1

2

3

4

Dimension

FREQ

UNIT

NA_ITEM

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

Anchor
SDMX21FTIME
SDMX21FTIME
SDMX 2.1 - REST - Data filtering on time

This allows filtering data observations within a time series on start and end dates.

Request
https://<api_base_uri>/sdmx/2.1/<resource>/<flowRef>/<key>?startPeriod=value&endPeriod=value

The start and end of the time period in the filter are determined as startPeriod and endPeriod. Following time periods are supported:

PeriodFormat

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
https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/NAMA_10_GDP?startPeriod=2012&endPeriod=2015 
Same, combined with dimension key filtering
https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/NAMA_10_GDP/A.CP_MEUR.B1GQ.LU?startPeriod=2012&endPeriod=2015 
Filtering on NAMQ_10_GDP quarterly observations from 2015 Q2 to 2015 Q3, combined with dimension key filtering
https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/NAMQ_10_GDP/Q.CP_MEUR.SCA.B1GQ.LU?startPeriod=2015-Q2&endPeriod=2016-Q2 
Filtering on IRT_EURYLD_M monthly observations from 2015 month 02 to 2016 month 06, combined with dimension key filtering
https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/IRT_EURYLD_M/M.YCIF_RT.Y17.GBA_AAA.EA?startPeriod=2015-02&endPeriod=2016-06 

Anchor
SDMX21FNN
SDMX21FNN
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
https://<api_base_uri>/sdmx/2.1/<resource>/<flowRef>/<key>?firstNObservations=<value>&lastNObservations=<value>

  1. This filter may be applied to data which has been filtered by dimension and / or time.

  2. First N Observations return the first N observations in the corresponding series

  3. Last N Observations return the last N observations in the corresponding series

  4. Both definitions may be applied e.g. to return the first and last observations in a series.

  5. 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
https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/NAMA_10_GDP?lastNObservations=5
Filtering on NAMA_10_GDP for the first 5 annual observations
https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/NAMA_10_GDP?firstNObservations=5
Filtering on NAMA_10_GDP for the first 5 and last 5 annual observations
https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/NAMA_10_GDP?firstNObservations=5&lastNObservations=5
Filtering on NAMA_10_GDP for the last 5 annual observations, combined with dimension key filtering
https://ec.europa.eu/eurostat/api/dissemination/sdmx/2.1/data/NAMA_10_GDP/.CP_MEUR.B1GQ.LU?lastNObservations=5

Anchor
SDMX21DATADETAILS
SDMX21DATADETAILS
SDMX 2.1 - REST - Data details

Request
https://<api_base_uri>/sdmx/2.1/<resource>/<flowRef>/<key>?details=value

as illustrated by