API response
Using the SDMX 2.0 RESTFUL Service as an example, the information below outlines the steps for building a request to get a couple of exchange rate indicators that are available in the IFS dataset:
- Use the DataFlow method to get the available datasets in our API.
http://0-dataservices-imf-org.library.svsu.edu/REST/SDMX_XML.svc/Dataflow
- Use the DataStructure method to get the data structure of the desired dataset. The data structure method requires the KeyFamilyID of the dataset, which you can get from the DataFlow. In this particular example, the ID would be IFS.
http://0-dataservices-imf-org.library.svsu.edu/REST/SDMX_XML.svc/DataStructure/IFS
The structure will include the codelists but you could also get codelists individually using the following query http://0-dataservices-imf-org.library.svsu.edu/REST/SDMX_XML.svc/CodeList/{Code List ID as specified in the data structure}.
http://0-dataservices-imf-org.library.svsu.edu/REST/SDMX_XML.svc/CodeList/CL_INDICATOR_IFS
- Use the CompactData method to get the data of interest to you. The requests should be in the following form (omitting what you do not need):
http://0-dataservices-imf-org.library.svsu.edu/REST/SDMX_XML.svc/CompactData/{database ID}/{item1 from dimension1}+{item2 from dimension1}+{item N from dimension1}.{item1 from dimension2}+{item2 from dimension2}+{item M from dimension2}?startPeriod={start date}&endPeriod={end date}.
The dimensions are separated by “.” and the order of the dimensions are based on the datastructure, but typically it would be FREQ, then REF_AREA, then INDICATOR.
Also, please note that the response to your request should not be more than 3000 series, which is the max result allowed. http://0-dataservices-imf-org.library.svsu.edu/REST/SDMX_XML.svc/GetMaxSeriesInResult. If the results are larger, you will need to send multiple requests. Please refer to this article on how to query large datasets with dataservices (http://0-datahelp-imf-org.library.svsu.edu/knowledgebase/articles/937155-how-to-query-large-datasets-with-data-services).
For a specific example, trying to get all available annual data for the following two indicators for all countries:
- Exchange Rates, Domestic Currency per U.S. Dollar, (EDNE_USD_XDC_RATE)
- Exchange Rates, Domestic Currency per U.S. Dollar, Period Average, Rate (EDNA_USD_XDC_RATE)
The query would look like ths:
Note that the example above omitted any values for REF_AREA, and START and END period since my intent was to get all available annual data for all available countries for the two indicators.
We hope you find this information useful. Should you have any further questions please feel free to contact us.
Sincerely,
Data Dissemination and Client Services Team
Data Operations Division
Statistics Department
International Monetary Fund