This tool converts between the legacy ONS API format and the new beta API format. You can:
Example API calls:
The tool can be used programmatically with the following endpoints:
?code=d7g7 or ?url=https://api.ons.gov.uk/timeseries/d7g7/dataset/mm23/data
?code=d7g7&format=json
{
"success": true,
"legacy_url": "...",
"new_url": "...",
"title": "...",
"data": { ... }
}
?code=d7g7&format=json&data_only=true
?url=https://api.ons.gov.uk/timeseries/d7g7/dataset/mm23/data&format=json&data_only=true
Parameters:
Here's an example of how to create a Vega chart using the ONS API data with our CORS proxy:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"url": "https://eco-cors-proxy.netlify.app/proxy?url=" +
"https://economicsobservatory.github.io/api/ons.html" +
"?code=l55o&format=json&data_only=true",
"format": {
"type": "json",
"property": "months"
}
},
"mark": "line",
"encoding": {
"x": {"field": "date", "type": "temporal"},
"y": {"field": "value", "type": "quantitative"}
}
}