Child pages
  • API - Getting started with statistics API

Versions Compared

Key

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

...

Info
iconfalse
titlePre-requisite

It is strongly recommended to read through the introduction of the JSON-stat toolkit by its author


Short word about JSON-statJSON-stat.org describe the format that is a simple lightweight JSON dissemination format best suited for data visualisation, mobile apps or open data initiatives.

...

For further usage details of the toolkit, please consult the  or the README of the jsonstat-toolkit

...

Then the dimensional structure of the dataset is summarized summarised in two arrays indicating the code and size of each dimension used by the dataset.

We can observe that the GEO dimension is quite large (2031 positions) as this dataset is a one of Eurostat's regional datasets, meaning that it contains statistical data for countries and their subdivision in statistical regions also called NUTS regison regions (see more information on NUTS classification)

Code Block
"id":[
  :    ["freq",
      "unit",
      "geo",
      "time"
   ],
   "size": [
      1,
      1,
      2031,
      33
   ],

Dimension metadata : index and label

The dimension object in the response contains for each uses dimension code an object as keys to references objects with its title and for each position (called category in JSON-stat) a list of key-value pair of its code and their corresponding order and a key-value pair of its code and corresponding label.

Code Block
"dimension":{
      "freq":{
         "label":"Time frequency",
         "category":{
            "index":{
               "A":0
            },
            "label":{
               "A":"Annual"
            }
         }
      },
     [...]

...

Filtering on geoLevel

As the above regional dataset have more than 2000 positions for the GEO dimension and is a regional dataset, it is interesting to make use of the special filter geoLevel to help retireving retrieving content for a specific NUTS levelFollowing . Following table list the filter value and example for possible value of this filter with example on DEMO_R_D3DENS dataset.

ValueDescription
aggregate

filter GEO dimension on European aggregates based on a white list - (EU15, EU25, EU27_2007, EU27_2019, EU28, EA19, etc.)


Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=aggregate
country

filter GEO dimension on country code (EU Member States, or EFTA, or Candidate Countries or other countries)

Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=country
nuts1

NUTS code level 1: filter GEO dimension on level-1 NUTS codes (major socio-economic regions)

Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=nuts1
nuts2

filter GEO dimension on level-2 NUTS code level 2: (basic regions for the application of regional policies)

Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=nuts2
nuts3

filter GEO dimension on level-3 NUTS code level 3: (small regions for specific diagnoses )

Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=nuts3

...

It is possible to restrict the response to a specific time value values or time value a range of values.

ValueDescription

time=YYYY

or

time_period=YYYY

Filter TIME dimension on a one or more specific time value values (ie. time=2020)

Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=country&time=2020
Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=country&time=2020&time=2019
sinceTimePeriod=YYYY

Filter TIME dimension on all time values since the specified value included (i.e for example sinceTimePeriod=2020 means "all time values since 2020, 2020 included")

Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=country&sinceTimePeriod=2020
untilTimePeriod=YYYY

Filter TIME dimension on all time values until the specified value included (i.e for example untilTimePeriod=2010 2000 means "all time values until 2000, 2000 included")

Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=country&untilTimePeriod=2000

sinceTimePeriod=YYYY

AND

untilTimePeriod=YYYY

Both filter above can be combined Filter TIME dimension by combining both above filters to define a FROM-TO range

(i.e for example sinceTimePeriod=2010&untilTimePeriod=2020 means "all time values from 2010 to 2020, both ends included")

Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=country&sinceTimePeriod=2010&untilTimePeriod=2020
lastTimePeriod=N

This fitler allows Filter TIME dimension to always retrieve the N latest positions for TIME dimension

(i.e for example lastTimePeriod=1 means 'most recent data" or lastTimePeriod=3 means "last 3 positions")

Code Block
https://ec.europa.eu/eurostat/api/dissemination/statistics/1.0/data/DEMO_R_D3DENS?lang=EN&geoLevel=country&lastTimePeriod=3

...

For example to retrieve only EU27 data for 2022 from of our example dataset, the following query should be used

...

From Eurostat query builder

Eurostat continue to provide website include a Query Builder on its website.

From Eurostat Databrowser

The advanced menu for download in DataBrowser is providing a query based on the currently visualized visualised data if you open the menu via Download > Options and other formats and then select the following options in below table (as shown in below screenshotImage Removed)



File formatJSON-stat (.json)
Data scopeData on this page only
EndpointJSON
Section
Column

Image Added

Column

Image Modified


From JSON-stat community

JSON-stat community is maintaining a showcase on Eurostat data that could also be used as a query builder or a data previewer 

...