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
  • an associated organisation
  • an associated datamart
Each export has executions representing its result at a given time.
An execution goes through different stages:
  • Pending if the export is not started
  • Running if the export is started
  • Succeeded or Failed 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

Create an export

You will first need to create a query for your 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
1
// Creating an export payload
2
{
3
"name": "<YOUR_EXPORT_NAME>",
4
"output_format": "JSON",
5
"query_id": "<ID_OF_QUERY_CREATED_IN_PREVIOUS_STEP>",
6
"type": "QUERY"
7
}
Copied!
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 array

Download the result of an export

The 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