Comment on page
Query Exports
The platform allows you to export data as
ndjson
, based on OTQL queries. This action is available in the navigator or through API to automate the process.For punctual exports, you may want to use the navigator (in Data Studio > Exports) rather than our API for more simplicity.
An export is a definition with:
- a name
- an output format (always
JSON
for now) - a type (always
QUERY
for now) - an associated query
Each export has executions representing its result at a given time.
An execution goes through different stages:
Pending
if the export is not startedRunning
if the export is startedSucceeded
orFailed
once the export has been completed
The resulting file is formatted in
ndjson
, and contains the properties you selected in the SELECT
part of the OTQL query.get
https://api.mediarithmics.com
/v1/exports?organisation_id=:orgId
Listing exports
get
https://api.mediarithmics.com
/v1/exports/:exportId?organisation_id=:orgId
Details of an export
You should check your query and verify its results before creating an export. It is easier to do at this step, as the export would only return an empty file and no message.
post
https://api.mediarithmics.com
/v1/exports?organisation_id=:orgId
Create an export
// Creating an export payload
{
"name": "<YOUR_EXPORT_NAME>",
"output_format": "JSON",
"query_id": "<ID_OF_QUERY_CREATED_IN_PREVIOUS_STEP>",
"type": "QUERY"
}
post
https://api.mediarithmics.com
/v1/exports/:exportId/executions
Generate an execution
get
https://api.mediarithmics.com
/v1/exports/:exportId/executions
Execution status
If available, the technical name of the file to download is in the
result.output_files
arrayThe result of an export is saved as a data file in the platform.
You have two methods to retrieve it :
- Using the exports API (recommended)
- Using the data_file API
get
https://api.mediarithmics.com
/v1/exports/:exportId/executions/:executionId/files/technical_name=:technicalName
Download using the exports API
get
https://api.mediarithmics.com
/v1/data_file/data?uri=mics://data_file/tenants/:organisationId/jobs/executions/:executionId/result/export.data
Download using the data_file API
get
https://api.mediarithmics.com
/v1/data_file/data?uri=mics://data_file/tenants/:organisationId/jobs/executions/:executionId/result/export.error
Download the error file
Last modified 2yr ago