dabug80
asked on
World Bank Data API: Converting links to data?
Hello,
The World Bank website currently allows anyone to use it's worldwide data
In the above page, the World bank provides a basic call structure format. Following this protocol, I have generated links such as:
Surface area (sq. km) of Ethiopia: http://api.worldbank.org/c ountries/E TH/indicat ors/AG.SRF .TOTL.K2?M RV=1&Gapfi ll=Y
Entering the above link into a url, returns the following data:
I'm not a programmer, but all I want to be able to do is grab the <wb:value> of 1104300 above and add it to a webpage, for multiple url links.
E.g my website would have 10 separate pages (one for each country) and on each of these pages would be the label: Surface area (sq. km): alongside the pulled World Bank data from the above url.
How would I approach this?
The World Bank website currently allows anyone to use it's worldwide data
In the above page, the World bank provides a basic call structure format. Following this protocol, I have generated links such as:
Surface area (sq. km) of Ethiopia: http://api.worldbank.org/c
Entering the above link into a url, returns the following data:
<wb:data xmlns:wb="http://www.worldbank.org" page="1" pages="1" per_page="50" total="1">
<wb:data>
<wb:indicator id="AG.SRF.TOTL.K2">Surface area (sq. km)</wb:indicator>
<wb:country id="ET">Ethiopia</wb:country>
<wb:date>2014</wb:date>
<wb:value>1104300</wb:value>
<wb:decimal>0</wb:decimal>
</wb:data>
</wb:data>
I'm not a programmer, but all I want to be able to do is grab the <wb:value> of 1104300 above and add it to a webpage, for multiple url links.
E.g my website would have 10 separate pages (one for each country) and on each of these pages would be the label: Surface area (sq. km): alongside the pulled World Bank data from the above url.
How would I approach this?
Just checked - you can't do it client-side in Javascript, because the CORS headers are missing on the World Bank API :(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent. Thanks for taking the time to code and explain. Really appreciate it.
You need some code and programming to extract the value from the XML. Which language do your programmers use, or which language is used on you web site?
There are 2 general approaches:
* Do it on the server. If your web site uses ruby code, then the logic of retrieving the links, parsing the XML and displaying it in context, will be written in ruby.
* Do it on the client. You will write Javascript code that runs in the browser to retrieve the links, parse the XML and display it in context.