API - What?
Fact: World Bank has been collecting massive amounts of data, for the past 50+ years, and now possesses one of the richest repository of information about economic development in the world.
World Bank Open API is an initiative of the World Bank that opens the wealth of the World Bank's global economic data to the outside world, in a standard, easily accessible way. Open API allows third parties to develop mash-ups and applications with the World Bank data and easily create different kinds of interesting visualizations and insightful reports.
A pilot version of the Open API system was released last year. Now the World Bank is releasing version 2.0 of the API that addresses many structural, technical and interface improvements. We were honored to be the architects and developers of this version.
Divide et Impera
One of the first things you notice when you look into World Bank data is the large volume. Currently, the API exposes a variety of data for approximately 200 countries for more than 50 years. Looking at the volume of data and hearing the feedback of API 1.0's users, it became obvious that being able to easily browse/explore data was as important as the interface to access a specific piece of information.
In addition to the large volume, the Bank had plans to expose more data through the same interface, so the architecture had to be scalable. To achieve the level of browseability and scalability required, we decided to dissect data into an extensible collection of well-defined entities, exposed through the API as query "end-points" in a REST architecture.
Endpoints currently exposed by the API are: Countries, Photos, LendingTypes, IncomeLevels, Indicators[$type], Authors, Topics, Keywords, Sources. A simple API call like: http://open.worldbank.org/v2/countries?api_key=XXXX returns the list of countries in the system, with some vital details about each country like: the name, iso2 code, region, income level, capital city, the geo data of the location of the capital etc. To get specifics about a particular country, you can use the iso2 code captured from the country listing to construct your next query: http://open.worldbank.org/v2/countries/ge?api_key=XXXX gives data regarding a particular country.
To get started with the World Bank API, you need to obtain a developer key from the API website: http://developer.worldbank.org. After free registration, you will be granted an API KEY that you need to add to all your calls as a query argument "api_key".
Aside from the list of the countries, another easy and interesting call explores the economic indicators in the system:
which gives a list of all indicators in the system, a short description, and the unique ID and the source of the indicator values. Source usually indicates which section or research group of World Bank has prepared the data. For instance, the enormously popular Doing Business Report (http://doingbusiness.org/) is indeed one of the sources exposed by the WB OpenAPI.
Again, you can use the ID to limit your query to the specific indicator type:
Since the API is now implemented as a well structured RESTful architecture, you can chain entities and filter an end-point by some other entity. For instance, you can easily look-up a list of indicators available for a specific country:
And, checking an indicator value across multiple years for a specific country is equally easy:
You can limit the result-set to a range of years:
(Note: to understand the unit of measurement of an indicator type, refer to the description of the indicator type provided by indicator queries).
There are many other types of useful queries you can use to explore World Bank data. Our goal here is not to re-create the official documentation, but to give you a sense of the powerful lookups you can issue, with just a web-browser and some URL tweaking, and no specialized tools. What you can do with actual code and integration with other tools is probably only limited by imagination.
We have no doubt that soon after the new API is released, different companies and individuals will come up with numerous creative ways to use the Bank's rich data in different mash-ups and visualizations and we will see many cool widgets and sites driven by the API.
We are very excited to be part of one more big step toward open data sharing and integration at the World Bank and would like to express our gratitude to the visionaries at the World Bank who are making their rich data freely accessible on the Web to the public.