Undata Api

UN Data API Project

GeneralQuery Endpoint: Retrieve a Full Dataset as XML

The GeneralQuery endpoint returns every record stored in a chosen dataset, delivered as XML. You place the dataset name directly in the URL path and pass your private UN Data API key as the user_key parameter. Each record comes back as a <record> element holding named <field> values such as Country or Area, Year(s), and Value.

Request Details

  • Method: GET
  • URL: http://undata-api.appspot.com/data/query/{dataset name1}
  • Parameters: key (text) — your private undata key
  • Result: XML-formatted data from the queried dataset (see Results)

Example Request

http://undata-api.appspot.com/data/query/{dataset name}?user_key=3scale-d54a9fc683b4478db97af95576612345

Example Response

<data>
<record>
<field name="Country or Area">Afghanistan</field>
<field name="Year(s)">2001</field>
<field name="Value">151</field>
</record>
<record>
<field name="Country or Area">Albania</field>
<field name="Year(s)">2001</field>
<field name="Value">27</field>
</record>
<record>
<field name="Country or Area">Argentina</field>
<field name="Year(s)">2001</field>
<field name="Value">62</field>
</record>
</data>

Replace the {dataset name} placeholder with the actual name of the dataset you want to access.

How the GeneralQuery Endpoint Works

The GeneralQuery endpoint returns every record in a dataset as XML. You supply the dataset name in the URL path and your private key as the user_key parameter. Each record is returned as a <record> element containing named <field> values such as Country or Area, Year(s), and Value.

Powered by 3scale logo
Powered by 3scale

Frequently Asked Questions

What does the GeneralQuery endpoint return?
It returns XML-formatted data for the queried dataset, with each record containing named fields such as Country or Area, Year(s), and Value. See the Results page for the response format.
What parameters does GeneralQuery accept?
The endpoint takes a key (text) parameter, which is your private UN Data API key, passed in the example as user_key.
How do I specify which dataset to query?
Replace {dataset name} in the URL path with the actual name of the dataset you want to access.
How is GeneralQuery different from FilteredQuery?
GeneralQuery retrieves the records in a dataset, while FilteredQuery lets you narrow results using filter criteria. Use GeneralQuery when you want the full dataset and FilteredQuery when you need a subset.
Where can I find the list of available datasets?
See the Datasets page for the available datasets, and the Home page for an overview of the wiki.

Explore More