Country Queries

Country

The following information is available for the countries and economies listed in the World Bank API:

Country ID (ISO3)
ISO2 Code
Name
Region id
Region Name
Income Level
Lending Type
Capital City
Longitude
Latitude

For example, the following will provide data about Brazil:
http://api.worldbank.org/countries/br/?api_key=xxxx

And here is the XML returned:

<wb:country id="BRA">
<wb:iso2Code>BR</wb:iso2Code>
<wb:name>Brazil</wb:name>
<wb:region id="LCR">Latin America & Caribbean    </wb:region>
<wb:incomeLevel id="UMC">Upper middle income    </wb:incomeLevel>
<wb:lendingType id="IBD">IBRD only    </wb:lendingType>
<wb:capitalCity>brasilia</wb:capitalCity>
<wb:longitude>-47.9291687</wb:longitude>
<wb:latitude>-15.7801476</wb:latitude>
</wb:country>

Example Calls

Below are example calls.

http://open.worldbank.org/countries?api_key=xxxx
Lists all countries

http://open.worldbank.org/countries/br/?api_key=xxxx
Returns entity data for particular country with ISO2 code “br” (ISO3 code can be used in place of ISO2 code)

http://open.worldbank.org/photos/keywords/phone;shop/countries
Returns all countries associated with photos tagged with either “phone” or “shop” keywords

http://open.worldbank.org/photos/2345/countries
Returns country associated with photo #2345
     
http://open.worldbank.org/photos/topics/Industry;Urban Development/countries
Returns all countries with photos about Industry or Urban Development
     
http://open.worldbank.org/indicators/SP.POP.TOTL/5M:10m/countries?date=2002:2007
Returns all countries with the population (indicator ID: SP.POP.TOTL) between 5 and 10 Million people

http://open.worldbank.org/countries/?regions=ECA;EAP&indicator[SP.POP.TOTL]=5M:5B&incomelevel=UMC&date=2002:2007 
This query returns all countries from ECA (Europe & Central Asia ) and EAP (East Asia  & Pacific) regions where income level is at the Upper-Middle level according to World Bank classification and population (indicator: SP.POP.TOTL) is between 5 million and 5 billion people from 2002 to 2007.
Note: incomelevel is a country attribute, not an indicator.

http://open.worldbank.org/countries&indicator[SP.POP.TOTL]=5M:10M&indicator[NY.GDP.MKTP.KD.ZG]=5:6&date=2002:2007
This query filters by values of two indicators simultaneously. Date range for the indicator values is: 2002-2007.

Comments

  1. Eliezer7 months ago

    Two problems:
    1) There's an error in the last example above. It has an & in place of a ?.
    2) I get a 504 Gateway Timeout on this query when it's properly formed.

  2. Irakli Nadareishvili7 months ago

    Ellezer,

    regarding (2): 504 Gateway Timeout is Mashery error code and usually occurs when you are trying to retrieve too large of data-set. Try paging your resultset to smaller chunks and if it does not help, please post the actual query you were trying to run?

    thx

  3. Eliezer7 months ago

    I was working with the last query above (which, by the way, still has a typo.)

    http://open.worldbank.org/countries?indicator[SP.POP.TOTL]=5M:10M&indicator[NY.GDP.MKTP.KD.ZG]=5:6&date=2002:2007

    Today, it's returning results, but I'm worried that more complex queries will time out. What are the timeout settings?

    Eliezer

Please sign in to post a comment.