Specifications
Web service provides a simple query interface to the World Health Organization's data and statistics content. This document describes version 3.12.3262.71 of the API.
- Data Warehouse (DW)
is a central repository of health data from multiple data sources.
- API
Application programming interface (API) defines a way through which it is possible to interact with data stored in DW. WHO Europe API uses HTTP as a transport protocol and JSON (CSV) format for a response object.
- JSON
JavaScript Object Notation (JSON) is an open standard format that uses human-readable text to represent data objects consisting of attribute-value pairs.
- CSV
Comma-separated values (CSV) is a format that uses plain text to represent tabular data using rows and columns that are separated by commas.
- Indicator
observed value of a variable, quantifiable characteristics which describes the health of a population.
- Measure
set of facts with unique code and bilingual name that are defining an indicator.
- Metadata
defines WHO Europe DW data structure including Measures, Attributes, Measure-Attribute Codes, Fact-Attribute Codes and Notes.
- Fact
the set of attribute codes that belongs to measured value and value itself.
- Attribute
there are fact and measure related attributes. Fact attribute can be related to one of 3 main dimensions: Place, Time or Person. Measure attribute describes entire measure (EXTERNID, DATA_SOURCE) or is common for all facts (UNIT_TYPE).
- Code
unique short name that is used for identifying entity in the DW. Usually upper case with Latin letters, numbers and underscore.
- Data source
is measure attribute that defines the area (division?) that data comes from.
- Data set
set of measures that are used for whatever purpose: visualization, data mining, investigations, ...
- Note
is plain text or HTML data related to Measures or Data sources that are collected in the DW.
http://HOST[:PORT]/api/v3/CONTROLLER[/CODE][?QUERY_PARAMETERS]
Without any of the optional components, the following URL structure:
http://HOST/api/v3/CONTROLLER
Returns a list of the available instances for the specified controller.
If you specify a code of the instance you will get detailed information about specified instance. Specifying query parameters allows you to specify language of the response, filter data (either in instance list or data in the instance itself) or to select which parts of the instance to return.
-
HOST
-
This is the domain of the web service. To access the API use
https://dw.euro.who.int
-
PORT
-
This is the port number for the web service. You can leave this out, or set it to the default HTTP port
80
-
CONTROLLER
-
This is a code of the controller to retrieve data from. Available controllers are:
countries
country_groups
data_sets
measures
version
export
export_metadata
export_data_set
classifications
categories
Each controller returns different kind of data.
-
CODE
-
This is the code of the instance that you want to get
-
QUERY_PARAMETERS
-
This is additional query parameters. Possible parameters are:
-
lang
— language of the response. Can be set either toEN
for English or toRU
for Russian. Default language in English. -
filter
— can be used for filtering either measures or facts within a certain measure.filter
value is a semicolon separated list of tokens in formATTRIBUTE:CODES_LIST
.CODES_LIST
is:-
a comma separated list of codes,
-
"
*
" - any specified value, -
"
$blank
" - unspecified value, -
ranges like
1999-2004
(ifATTRIBUTE
is integer valued), -
"
~[year]
" or "[year]~
" - nearest available year filter, where "~
" character specifies in which direction data should be searched, e.g.:~2001
- if data for the2001
year is missing, then data from the nearest previous year is returned.
Codes within the same
ATTRIBUTE
are logically ORed. DifferentATTRIBUTES
are logically ANDed.COUNTRY
attribute supportsCOUNTRY_GRP
codes asCODES_LIST
values meaning countries in specified country groups. -
-
output
— can be used inmeasures
andcategories
controllers to select which part or parts of the object should be returned. Possible values are:data
,metadata
,attributes
,notes
,classifications
for measures andmeasures
,subtree
for categories.output
parameter can be set to either of these values or to a comma separated list of them. -
updated_since
— useful for retrieving information about measures and data sources that were changed since certain date. -
dataState
— allows you to download codes and labels for measures and classifications that are currently unpublished in Data Warehouse. -
format
— defines format of the files that are exported by the API. Used only for data export and can be set to eitherxlsx
orcsv
.
-
The API provides data in JSON format. For each specific CONTROLLER
structure of the returned object is different. See examples for more clarification.
- Example 1 — Getting API version
- Example 2 — Retrieving a list of instances
- Example 3 — Retrieving detailed information about an instance
- Example 4 — Selecting the language of the response
- Example 5 — Selecting measure's object parts
- Example 6 — Filtering data
- Example 7 — Filtering by country
- Example 8 — Exporting data
- Example 9 — Exporting metadata
- Example 10 — Retrieving hierarchical measure structure
- Example 11 — Data sets
Example 1 — Getting API version
To get current version of the API use the following URL: /api/v3/version
.
Example 2 — Retrieving a list of instances
To get a list of instances use one of the following URLs:
/api/v3/countries
to get a list of countries./api/v3/country_groups
to get a list of country groups./api/v3/data_sets
to get a list of data sets./api/v3/measures
to get a list of measures.
Example 3 — Retrieving detailed information about an instance
To get detailed information about an instance you should specify code of the instance to get:
/api/v3/countries/UKR
returns information about Ukraine./api/v3/country_groups/EU_MEMBERS
returns information aboutEU_MEMBERS
country group which is the European Union./api/v3/measures/H2020_1
returns information aboutH2020_1
measure.
Specifying instance code in the API URL makes API return detailed information about this instance. For example, detailed information about country
contains a list of country_groups
that it belongs to; detailed information about measure
contains list of metadata
, attributes
, facts
, notes
and classifications
related to this measure.
Example 4 — Selecting the language of the response
To select the language of the response lang
parameter is used. It can be set to either EN
or RU
for English or Russian respectively:
/api/v3/countries?lang=EN
returns information in English./api/v3/country_groups/CIS?lang=RU
returns information in Russian./api/v3/measures/H2020_1?lang=ru
is also OK; language parameter is case insensitive.
Default language is English so if lang
parameter is not specified English response is returned.
Example 5 — Selecting measure's object parts
To select which part of measure object the API should return set output
parameter to either attributes
, metadata
, data
, notes
, classifications
, data_sets
or dimensions
or to a comma separated list of them:
/api/v3/measures/H2020_1?output=data
returns onlydata
of the measure./api/v3/measures/H2020_1?output=metadata
returns onlymetadata
of the measure./api/v3/measures/H2020_1?output=data,attributes
returnsattributes
anddata
of the measure omitting itsmetadata
.
Example 6 — Filtering data
The only two instances that can be filtered are measures and measure's facts. Measures are filtered by their metadata attributes:
/api/v3/measures?filter=DATA_SOURCE:HFA
returns measures that haveHFA
DATA_SOURCE
/api/v3/measures?filter=UNIT_TYPE:NUM_BEDS,NUM_DAYS
returns measures that haveUNIT_TYPE
eitherNUM_BEDS
orNUM_DAYS
./api/v3/measures?filter=DATA_SOURCE:HFA,ENHIS;UNIT_TYPE:KM2
returns measures that haveDATA_SOURCE
eitherH2020
orENHIS
andUNIT_TYPE
KM2
.
Facts are filtered by attributes:
/api/v3/measures/HFA_1?filter=SEX:FEMALE,MALE
returnsHFA_1
facts that haveSEX
attribute set toFEMALE
orMALE
.-
/api/v3/measures/H2020_1?filter=YEAR:2004-2007,2011
returnsH2020_1
facts that haveYEAR
attribute set to2004
,2005
,2006
,2007
or2011
. /api/v3/measures/H2020_1?filter=YEAR:~2050
returnsH2020_1
facts for2050
or if the value is missing then facts from the closest year before2050
./api/v3/measures/H2020_1?filter=YEAR:2000~
returnsH2020_1
facts for the2000
year or if they are missing then facts from the closest year with data after the2000
year./api/v3/measures/H2020_1?filter=COUNTRY:ALB;YEAR:2002,2003;MEASURE_TYPE:AGE_STD_RATE
returnsH2020_1
facts that haveCOUNTRY
set toALB
,YEAR
set to either2002
or2003
andMEASURE_TYPE
set toAGE_STD_RATE
./api/v3/measures/HFAMDB_1?filter=SUBNATIONAL_MDB:*
returnsHFAMDB_1
facts that haveSUBNATIONAL_MDB
attribute specified./api/v3/measures/HFAMDB_1?filter=SUBNATIONAL_MDB:$blank;SEX:ALL
returnsHFAMDB_1
facts that haveSUBNATIONAL_MDB
attributed unspecified andSEX
set toALL
.
You can also filter measures and data sets by last updated date:
/api/v3/data_sets?updated_since=2015-12-27
returns list of data set codes that were updated after 27 Dec 2015/api/v3/measures?updated_since=2015-12-01
returns list of measure codes that were updated after 01 Dec 2015/api/v3/measures?updated_since=2015-12-18T19:00
returns list of measure codes that were updated after 18 Dec 2015 19:00
Request for certain data set or measure with updated_since
parameter returns true
if this data set or measure was updated since certain date and false
othervise:
/api/v3/data_sets/HBSC?updated_since=2016-01-05
returnstrue
henceHBSC
data set was updated after 05 Jan 2016/api/v3/data_sets/H2020?updated_since=2015-12-11T15:00
returnsfalse
henceH2020
data set wasn't updated after 11 Dec 2015 15:00/api/v3/measures/H2020_10?updated_since=2015-12-27
returnsfalse
becauseH2020_10
measure wasn't updated after 27 Dec 2015
Example 7 — Filtering by country
You can filter measure's facts by country:
/api/v3/measures/H2020_1?filter=COUNTRY:BGR,AUT,UKR
returnsH2020_1
facts that haveCOUNTRY
attribute set toBGR
,AUT
orUKR
./api/v3/measures/H2020_1?filter=COUNTRY:*
returnsH2020_1
facts that haveCOUNTRY
attribute specified./api/v3/measures/H2020_1?filter=COUNTRY:$blank;YEAR:2003
returnsH2020_1
facts that haveCOUNTRY
attributed unspecified andYEAR
set to2003
.
There are some exceptions in the logic of filtering when applied to attributes COUNTRY
and COUNTRY_GRP
. Some examples:
/api/v3/measures/H2020_1?filter=COUNTRY_GRP:EU_MEMBERS
returnsH2020_1
facts that haveCOUNTRY_GRP
equalEU_MEMBERS
./api/v3/measures/H2020_1?filter=COUNTRY_GRP:EU_MEMBERS;COUNTRY:ITA
returnsH2020_1
facts that have eitherCOUNTRY_GRP
attribute setEU_MEMBERS
orCOUNTRY
attribute set toITA
./api/v3/measures/H2020_1?filter=COUNTRY:ITA
returnsH2020_1
facts that haveCOUNTRY
set toITA
./api/v3/measures/H2020_1?filter=COUNTRY:ALB,EU_MEMBERS
returnsH2020_1
facts that haveCOUNTRY
set toALB
or any country inEU_MEMBERS
country group.
Example 8 — Exporting data
You can export measure data in csv or excel format. Export the data when you need to work in an application that is not connected to the API, for example in Excel or other applications. Excel is the default format when exporting measures.
Each export request (for a measure or data set) returns a JSON response.
/api/v3/export/H2020_1
returns H2020_1
measure data.
{
"status": "InQueue",
"time_elapsed_seconds": 0,
"check_status_url":"/api/v3/export/status/c2df1c001eb64309b12f97a920bc3ecc"
}
The first property is the status code of the export process. Possible status codes are:
- “InQueue” - file is waiting in queue to be processed,
- “Processing” - file generation has started,
- “Generated” - file processing completed and available for download,
- “Failed” - file processing failed.
Second property "time_elapsed_seconds" is the number of seconds since the file has been requested. It is only present if status property is “InQueue” or “Processing”. The property "check_status_url" provides URL to check the export process during a status of “InQueue” or “Processing”.
When the file processing is completed and available for download, the following response is displayed:
{
"status": "Generated",
"generated_time": "2018-01-21T13:45:21.2249016",
"file_size_kb": 59,
"download_url":"/api/v3/export/download/6522933299f54d20b58dd013b506dd2"
}
The property "generated_time" is the date and time in ISO format, and shows when the file was processed. The property "file_size_kb" shows the size of the processed file in kilobytes. The property "download_url" displays the URL for a direct download of the processed file.
Here are examples of export URLs with various filters:
/api/v3/export/H2020_1
exports excel file withH2020_1
measure data./api/v3/export/H2020_1?format=xlsx
exports excel file withH2020_1
measure data./api/v3/export/H2020_1?format=csv&lang=ru
exports csv file withH2020_1
measure data in Russian.
You can also export multiple measures in one file:
/api/v3/export?code=H2020_1,H2020_2
exports data forH2020_1
andH2020_2
measures in one xlsx file./api/v3/export?code=HFA_1,ENHIS_12,ENHIS_32&format=csv&lang=ru
exports zip file that contains three csv files forHFA_1
,ENHIS_13
andENHIS_32
measures in Russian.
It is also possible to export data set entirely or only some of the measures of the dataset:
/api/v3/export_data_set/H2020
exports zip file containing metadata and data of measures that belong toH2020
data set./api/v3/export_data_set/H2020?measures=H2020_1,H2020_2,H2020_3
exports zip file containing metadata and data ofH2020_1
,H2020_2
andH2020_3
measures ofH2020
data set
You can also filter exported measures facts by some attribute:
/api/v3/export/HFAMDB_1?filter=SUBNATIONAL_MDB:$blank
exports excel file withHFAMDB_1
measure facts that haveSUBNATIONAL_MDB
attribute unspecified./api/v3/export/HFAMDB_1?filter=SUBNATIONAL_MDB:*&format=csv&lang=ru
exports Russian csv file withHFAMDB_1
measure facts that haveSUBNATIONAL_MDB
attribute specified./api/v3/export_data_set/H2020?filter=COUNTRY_GRP:NORDIC
exports zip file containing metadata and data of measures that belong toH2020
data set. Only measures facts that haveCOUNTRY_GRP
equalNORDIC
will be present./api/v3/export_data_set/H2020?measures=H2020_1,H2020_2,H2020_3&filter=COUNTRY:UKR
exports zip file containing metadata and data ofH2020_1
,H2020_2
andH2020_3
measures ofH2020
data set. Only measures facts that haveCOUNTRY
attribute set toUKR
will be present.
Example 9 — Exporting metadata
You can export metadata in excel format:
/api/v3/export_metadata
exports file with entire metadata./api/v3/export_metadata?dataState=unpublished
exports file with unpublished measures and classifications/api/v3/export_metadata?dataState=all
exports file with all measures and classifications from the Data Warehouse/api/v3/export_metadata/measure
exports file with measures metadata.
Example 10 — Retrieving hierarchical measure structure
To get available measure classifications you can use classifications
request:
/api/v3/classifications
returns list of measure classifications
To get detailed information about classifications like sub-categories or measures assigned to subcategories use categories
controler:
/api/v3/categories/D
returns whole classification tree with categories, sub-categories, sub-sub-categories (if exist) and measures related to them for classificationD
/api/v3/categories/D03_00
returns measures assigned to categoryD03_00
and its sub-categories (if exist)/api/v3/categories/D03_00?output=measures
returns measures assigned to categoryD03_00
without its sub-categories/api/v3/categories/D03_00?output=subtree
returns sub-categories of categoryD03_00
without measures assigned to it/api/v3/categories
returns entire classification tree for all classifications with measures assigned to each category/api/v3/categories?output=subtree
returns classification tree for all classifications without measures/api/v3/measures/HFA_1?output=classifications
each measure hasclassifications
property that contains list of categories that the measure is assigned to groupped by classifications. This can be used for getting a list of categories that the measure is assigned to and then getting related measures
Example 11 — Data sets
To get list of data sets or list of data set measures:
/api/v3/data_sets
returns list of all available data sets/api/v3/data_sets/H2020
returns list of all measures of the data set
To get measure data in context of certain data set:
/api/v3/data_sets/H2020/H2020_1
returnsH2020_1
measure data in context ofH2020
data set with data set specific country list, data set notes etc.