Point an AI assistant at data.un.org
The REST API, no key
One containment expression in place of 37 requests.
Lesson 1 of 3 · Automate it
Try it yourself
- Connect: the platform's own API documentation
-
africa<-containedInPlace+{typeOf:Country}
Remember: Do not skip: join each series to its facet, its unit and publisher, or you ship a number with no unit.
Transcript
- If you write code, the search box is the slowest way in. Here is the fast one, run for real.
- The Connect page documents two surfaces. No registration, no key, and no licence to negotiate.
- When you know the indicator and the countries, one POST returns every year for all of them. And there is the same figure the interface gave you, straight out of the API.
- The catch is that the numbers and their meaning come back in separate objects. Each series carries a facet id; look it up and you get the unit and the publisher. Skip that step and you have shipped a bare number.
- And this is the expression worth memorising. Contained-in-place asks for every country inside a region. One request, thirty-seven countries, and no list of country codes to maintain.
- But read what actually came back. Mauritius is twenty twenty-four; Eritrea is twenty twelve. Eleven different reference years in one response. Sort that by value and you have built exactly the misleading ranking from video four.
- It answers cross-origin too, so a static page with no server behind it can query the UN knowledge graph directly.