Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Joseph Coveney has correctly identified the reason for the error: the CSV format is not appropriate in this query.
    The data is available in CSV format. Hence the following query works:
    http://api.worldbank.org/en/Countries/chn?format=csv
    The following query also works:
    http://api.worldbank.org//////////////////////en/Countries/chn?format=csv
    The number of slashes doesn't matter. Any properly configured server will resolve it in a reasonable way, in this case collapsing multiple slashes into a single one.

    To get the metadata use the following query returning an XML file:
    Code:
    tempfile tmpfil0
    copy "http://api.worldbank.org/en/Countries/All" `tmpfil0'
    view `tmpfil0'
    Returns:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <wb:countries page="1" pages="6" per_page="50" total="262" xmlns:wb="http://www.worldbank.org">
      <wb:country id="ABW">
        <wb:iso2Code>AW</wb:iso2Code>
        <wb:name>Aruba</wb:name>
        <wb:region id="LCN">Latin America &amp; Caribbean (all income levels)</wb:region>
        <wb:adminregion id="" />
        <wb:incomeLevel id="NOC">High income: nonOECD</wb:incomeLevel>
        <wb:lendingType id="LNX">Not classified</wb:lendingType>
        <wb:capitalCity>Oranjestad</wb:capitalCity>
        <wb:longitude>-70.0167</wb:longitude>
        <wb:latitude>12.5167</wb:latitude>
      </wb:country>
    ......
    Note the response is in multiple pages, and starts with a BOM (not shown). You'll have to deal with both in your program.

    Hope this helps. Sergiy Radyakin
    Last edited by Sergiy Radyakin; 06 Sep 2014, 03:01.

    Comment

    Working...
    X