This tutorial presents how to download WHO/Europe Data Warehouse metadata from the WHO/Europe Data Warehouse Application Programming Interface by using jsonlite package in R. Another tutorial - What do you need installed to query data in API - shows how to include jsonlite into R. Make sure that the jsonlite package is installed in your RStudio and it is included into your code.
See the below video about how to download WHO/Europe Data Warehouse metadata. Note: Russian subtitles are available for the video.
1. To download metadata it is necessary to specify a reference to the WHO/Europe Data Warehouse API URL. Create a variable, called “url” with the following value:
url=”http:/dw.euro.who.int/api/v3/measures/”
2. If you need to find out more information about the methods in the WHO/Europe API, see the documentation at API Specifications.
3. Data will be extracted using functions readLines and fromJSON of jsonlite package using this code.
rd <- readLines(url, encoding=”UTF-8”, warn=F) data_from_api <- fromJSON(rd,simplifyDataFrame = TRUE)
4. This code will create a data frame called “metadata_from_api” which will contain all metadata from the Data Warehouse. It contains several columns. Column “code” is a unique identifier for the indicator. Column “short_name” is its short name. There are also several other columns which are explained in the documentation.
5. Now you can use this data frame to search through the indicators and work with the information available in the Data Warehouse.
In other video tutorials we will show how to download indicator specific data using the API.