Indicator Queries

Indicators

Indicators represent data like total population, Gross National Income, Energy use, and many more.  The following information is available for each indicator:

Code
Name
Source ID
Source Note
Topic ID
Topic Name

For example, the following query will return information about GDP in current US dollars:

http://api.worldbank.org//indicators[BNY.GDP.MKTP.CD]?api_key=xxxx

And here is the xml returned:

<wb:indicator id="NY.GDP.MKTP.CD">
<wb:name>GDP (current US$)</wb:name>
<wb:source id="2">World Development Indicators</wb:source>
<wb:sourceNote>GDP at purchaser's prices is the sum of gross value added by all resident producers in the economy plus any product taxes and minus any subsidies not included in the value of the products. It is calculated without making deductions for depreciation of fabricated assets or for depletion and degradation of natural resources. Data are in current U.S. dollars. Dollar figures for GDP are converted from domestic currencies using single year official exchange rates. For a few countries where the official exchange rate does not reflect the rate effectively applied to actual foreign exchange transactions, an alternative conversion factor is used.
  World Bank national accounts data, and OECD National Accounts data files.</wb:sourceNote>
<wb:topics>
<wb:topic id="644279">Macroeconomics and Economic Growth</wb:topic>
</wb:topics>
</wb:indicator>

Example Calls

http://open.worldbank.org/indicators
Lists all indicators

http://open.worldbank.org/indicators[SP.POP.TOTL]?api_key=xxxx
Returns the definition of the indicator SP.POP.TOTL, in this case, total population

http://open.worldbank.org/source/Doing Business/indicators?api_key=xxxx
Displays all indicators for the source: Doing Business
 
http://open.worldbank.org/source/1/indicators?api_key=xxxx
Displays all indicators for the source: Doing Business referred by numeric ID.

http://open.worldbank.org/countries/br/indicators?api_key=xxxx
Lists all available indicators for country Brazil (this call also accepts ISO3 code)

http://open.worldbank.org/countries/br/indicators/NY.GDP.MKTP.CD?api_key=xxxx
Returns the GDP (in current US$) for Brazil (this call also accepts ISO3 code)

http://open.worldbank.org/topic/Energy/indicators?api_key=xxxx
Returns indicators associated with topic: Energy

http://open.worldbank.org/topic/644304/indicators?api_key=xxxx
Returns indicators associated with topic: Energy referred by numeric ID

http://open.worldbank.org/countries/all/indicators/NY.GDP.MKTP.CD?date=2002:2002?api_key=xxxx
Returns the GDP for ALL countries (please note the "all" special keyword) in 2002.

Sample Uses

It may be quite common to use the API to get indicator data related to countries. 

To explore what indicators are available for a particular country, in this case Brazil, use:
http://open.worldbank.org/countries/br/indicators/?api_key=xxxx

In order to get one indicator for a country - for example GNI per capita for Brazil in current US$ using the Atlas method, use:
http://open.worldbank.org/countries/br/indicators[BNY.GNP.PCAP.CD]/?date=2006:2006?api_key=xxxx

By default, the GNI call above gives all the data available.  If you want just the GNI data from, say, 1960 to 1970, use:

 

 

Comments

  1. royce7 months ago

    Is it just me or are all/most of the queries on these pages wrong??? I can use the generator to test calls, but when I cut and paste these sample queries (and use my api_key) I get either "401 Authorization Required" messages or "URL not found on this server"???

  2. Uzair7 months ago

    Is there any way to request a valid date range for a particular indicator? For example, Credit Information Index stats appear to be available 2005 on; I'm sure I could find an example where data is available for one country but not another for some indicator/date pair too. I can clean the data after retrieving, of course, but perhaps a few convenience functions would be more efficient?

  3. mixtli7 months ago

    When I get an indicator, the data entries come back with numeric countryIDs. How do I relate those back to countries?

    For example:
    curl http://open.worldbank.org/countries/all/indicators/NY.GDP.MKTP.CD
    <wb:data>
    <wb:countryID>234</wb:countryID>
    <wb:indicatorID>1</wb:indicatorID>
    <wb:date>2006</wb:date>
    <wb:val></wb:val>
    </wb:data>

    What is 234?

  4. Irakli Nadareishvili6 months ago

    mixtli,

    the problem you mentioned is fixed. API returns codes for countries and indicators now.

Please sign in to post a comment.