•   over 8 years ago

Effective data fetching by country in API

Hi,
I'm trying to fetch data in as few requests as possible. So for fetching data for all countries for a given indicator the API for example supports the request:
http://api.worldbank.org/countries/all/indicators/DT.NFL.UNRW.CD?per_page=20000&format=json
But I have not found a similar way to fetch all the indicator data for a given country, e.g.:
http://api.worldbank.org/indicators/all/country/BR?per_page=20000&format=json
or maybe limited by topic so we dont get a too large result set:
http://api.worldbank.org/topic/1/indicators/all/country/BR?per_page=20000&format=json
I see a need for this functionality in order to get the full picture for a country in one (maybe per topic) request. At least I would have need for it :).
The alternative is to make say 200 requests (one per country) to gather the data.
If not already there, will it be supported in the future?
 
Thanks for an exiting challange!
/Centaurus

  • 2 comments

  • Manager   •   over 8 years ago

    Hi Centaurus, we'll make sure the WB data team sees this and gets back to you soon.
    Thanks. -Brandon

  •   •   over 8 years ago

    Hi Centaurus,

     Thanks for the feedback on the API. We are working to improve the API and we will certainly look into your suggestions. For now, you can get the list of indicators under a topic with a single API call, but for the indicator data you have to make individual calls. Find below a possible way for obtaining the data.

    1) To get a list of all Topics, make the following call

    http://api.worldbank.org/topics
     
    <topic id>/indicators. For example, if the user wants list of all indicators under "Aid Effectiveness" Topic id "2" as obtained in the previous query, the API call will be http://api.worldbank.org/topics/2/indicators

    3) This will list all the indicator name and id under the topic. Then loop through all the indicators and obtain data for all the indicators.
    There is also an existing page giving general guidance, on how to use the API's
    http://data.worldbank.org/node/209
     Hope that helps.
    Cheers,
    Sup

    . This will provide a list of all available topics.
    2) To get a list of indicators for a particular Topic, the API call will look like this http://api.worldbank.org/topics/

     

Comments are closed.