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.
