Hi,
Thanks for using Worlbank APIs. Please find the below answers to your
questions (order same as the questions),
1) Parameter 'MRV' used to fetch most recent values based on the
number specified. Refer
http://data.worldbank.org/node/11 for more
information about MRV and general API call structures.
For ex.,
http://api.worldbank.org/countries/all/indicators/SP.POP.TOTL?MRV=1&per_page=250&format=json
2) There is no option to get list of countries only. In this list,
Regions/Aggregates contain the region id as 'NA' and name as
'Aggregates'. so if you eliminate these items from the list then you
will get the list of countries only.
<wb:country id="ARB">
<wb:iso2Code>1A</wb:iso2Code>
<wb:name>Arab World</wb:name>
<wb:region id="NA">Aggregates</wb:region>
<wb:adminregion id="" />
<wb:incomeLevel id="NA">Aggregates</wb:incomeLevel>
<wb:lendingType id="">Aggregates</wb:lendingType>
<wb:capitalCity />
<wb:longitude />
<wb:latitude />
</wb:country>
3) We have many derivations and aggregations that result in values
with extra decimal places or values with decimals that should be
integers or values beyond a level of expected accuracy (e.g. GDP to
the level of one dollar rather than say one million dollars). We are
planning to address this issue with proper levels of rounding in the
near future. In the meantime, we are happy to advise on specific
questions about the accuracy of any indicator.
4) The decimal value indicates the preferred precision value that can
set for each indicator
5) Great comments. We will keep your suggestions in mind for future
API updates.
Hope these would help and write us if you need any other
clarifications.
Regards,
Shanmugam
On Mar 15, 2:12 pm, xavier dutoit <
xav...@tttp.eu> wrote:
> Hi,
>
> I'm using the API to get the population of countries. I have several
> issues, not sure if it's me not finding the proper documentation or if it's
> a missing feature. Please tell me:
>
> 1) getting the most recent data
> For the population, some countries do have the 2010 data, some 2009...
> if I fetch the apihttp://
api.worldbank.org/countries/all/indicators/SP.POP.TOTL?date=20...
>
> I will get an empty value for the countries that are 2009. Is there an
> option ?date=latest
>
> The workaround is obviously to fetch several years, but a bit clunky IMO
>
> 2) Get only countries
>
> when you call all, it gives all countries (now that I figured out the
> per_page & so on parameters) but it gives as well the regions (eg. 1A 'Arab
> world' EU...)
>
> is there an option to get only the countries?
>
> 3) some values on the population have '.' eg. 2201569786.92315
> I fail to see how you can end up with and extra 0.9315 person on the total.
> What does it mean?
>
> 4) there is an extra decimal that is always 0. Is there a way of specifying
> the return values you want and skip it (no a big deal)
>
> 5) json formatting:
> I'm fully aware that that's unlikely it will be changed, but wanted to
> point out a few "looks weird" moment I had
>
> a) the first level is always an array with 0 containing the context
> (pagination data..) and the 1 containing the data. Would have been nicer
> IMO to have named them
>
> {
> 'context': { 'page':1...}
> 'data': [....]
>
> b) you are repeating a lot of redundant info: for every country, you repeat
> the indicator (both its id & value). It would be more bandwidth friendly &
> readable to put them only one in the context, so
>
> {
>
> - context: {
> - "page": 1,
> - "pages": 25,
> - "per_page": "10",
> - "total": 244
> - "indicator": {
> - "id": "SP.POP.TOTL",
> - "value": "Population, total"
> }
> },
> - data: [
> - {
> - "country": {
> - "id": "1A",
> - "value": "Arab World"
> },
> - "value": "357867176.869422",
> - "decimal": "0",
> - "date": "2010"
> },
> - {
> - "country": {
> - "id": "Z4",
> - "value": "East Asia & Pacific (all income levels)"
> },
> - "value": "2201569786.92315",
> - "decimal": "0",
> - "date": "2010"
> },
> -
>
> That's it for me, thanks for making your data available, super userful
>
> For reference: that's the output I get
> [
>
> - {
> - "page": 1,
> - "pages": 25,
> - "per_page": "10",
> - "total": 244
> },
> - [
> - {
> - "indicator": {
> - "id": "SP.POP.TOTL",
> - "value": "Population, total"
> },
> - "country": {
> - "id": "1A",
> - "value": "Arab World"
> },
> - "value": "357867176.869422",
> - "decimal": "0",
> - "date": "2010"
> },
> - {
> - "indicator": {
> - "id": "SP.POP.TOTL",
> - "value": "Population, total"
> },
> - "country": {
> - "id": "Z4",
> - "value": "East Asia & Pacific (all income levels)"
> },
> - "value": "2201569786.92315",
> - "decimal": "0",
> - "date": "2010"
> },
> -