Use GMWO swagger API to download data
The API swagger page can be used to download data without having to code it into a API-supported language (e.g. Python).
This could be used a workaround for users of the Excel plug-in, but who don't know how to set up API requests in a coding language.
https://model.oxfordeconomics.com/api/v1/swagger/
1. Find the path to the GMWO database that you want e.g.
/oxford-economics/releases/GEM/Oct23_1 5yr
2. Go to ForecastOperation, /v1/operations/export, hit ‘Try it out’
- Enter the path into the ‘InputForecast’ field, and fill in the rest of the selections. For example, to export US and UK GDP and CPI between 2020 and 2028 from the Oct23_1 5yr database, use the below:
- Formatting options are also found at the end. Many of these options are aligned to the parameters in the MDL export command
{
"Range": {
"From": "2020Q1",
"To": "2028Q4"
},
"Format": "Default",
"AnnualRollup": false,
"SeriesSelection": [
{
"Indicator": "GDP",
"Location": "US",
"Transformation": "L",
"ValueType": "Variable"
},
{
"Indicator": "GDP",
"Location": "UK",
"Transformation": "L",
"ValueType": "Variable"
},
{
"Indicator": "CPI",
"Location": "US",
"Transformation": "L",
"ValueType": "Variable"
},
{
"Indicator": "CPI",
"Location": "UK",
"Transformation": "L",
"ValueType": "Variable"
}
],
"InputForecast": "/oxford-economics/releases/GEM/Oct23_1 5yr",
"OperationName": ""
}
Formatting options:
- Default. One row per series. Various metadata columns. Includes headers.
- DefaultExtended. One row per series. A few extra metadata columns compared to Default. Includes headers.
- Classic_v. Similar to Model software's one-column-per-series export.
- Classic_h. Similar to Model software's Vars By Row export.
- Skinny. Tall narrow format for import into cubes.
- DatabankCompatible. One row per series, matching format of Global Data Workstation, Excel Data Workstation.
- DatabankCompatibleStacked. One row per series and period, matching format of Global Data Workstation, Excel Data Workstation.
3. Execute, you will get an ‘enqueued operation’ with the response with something like:
{
"Artifacts": [],
"Resources": [],
"Id": "23652",
"CreatedAt": "2023-10-17T09:09:12.397+00:00",
"StartedAt": null,
"CompletedAt": null,
"Status": "Queued",
"Duration": null,
"FailureReason": null,
"Name": ""
}
4. Take the ‘Id’ value and check the status of the export using the ‘await’ endpoint
- Go to /v1/operations/{id}/await and hit ‘Try it out’
- Enter the Id value from above and Execute
- You should receive a response with an ‘Artifact’ and it’s Id and the status of ‘Succeeded’
{
"Artifacts": [
{
"Id": "f898e525-255b-4082-82ef-44a74d5fea23",
"Filename": "series-2020-2028_Oct23_1 5yr.csv",
"Type": "text/csv",
"DownloadUrl": "https://model.oxfordeconomics.com/api/v1/operations/23652/artifact/f898e525-255b-4082-82ef-44a74d5fea23"
}
],
"Resources": [
{
"Id": "370c8757-faae-411b-939d-b53ad116dadd",
"Path": "/oxford-economics/releases/GEM/Oct23_1 5yr",
"Version": 0,
"Role": "Input"
}
],
"Id": "23652",
"CreatedAt": "2023-10-17T09:09:12.397+00:00",
"StartedAt": "2023-10-17T09:09:12.5102594+00:00",
"CompletedAt": "2023-10-17T09:09:19.5342594+00:00",
"Status": "Succeeded",
"Duration": 7024,
"FailureReason": null,
"Name": ""
}
5. Download the export (artifact) using the endpoint /v1/operations/{operationId}/artifact/{artifactId}
- Use the operationId as the first ‘Id’ we found from step 4
- Use the artifactId as the Id from the above step (5)
- The response should be a link to download a csv