Search…
Export
You can create data exports through the admin UI or directly through the API. Creating exports through the API is helpful when needing to automate an export process.
Export object instances define export jobs to run including details such as type of export, query and aggregation criteria, export paths to include, and more. Each export instance represents one specific export job. Export jobs are queued in the background and each org can run one job at a time. Although you can create as many export jobs as you'd like, they will run sequentially in the order they were created.
Exported data is archived in zip format and stored securely in an encrypted file store within Cortex. When the export job is complete, a secure download link will be provided in the export's dataFile property. This link can only be accessed by an authenticated user with administrator privileges. Exports are available for download for seven days, after which the export and archive are deleted.
Export archive sizes count against file storage limits in your org.

Export Object Properties

Name
Type
Description
label
String
The label for your export. This appears in the export jobs UI
description
String
The description of your export. If present, this appears in the export jobs UI
state
String
The current state of the export job. Can be pending, running, ready, error
exportFiles
Boolean
When selected, if the export contains files, they will be included along-side the exported data. Note, this can cause exports to take a long time to complete if there are many large files.
zipFiles
Boolean
Applies with exporting files. If true, files are archived together in a zip archive within the exported archive.
format
MIME-type
The format of the exported data. Valid types are: application/x-ndjson: New-line delimited JSON application/json: JSON format * text/csv: CSV format
objects
String
The plural name of the Cortex object being exported.
paths
String Array
Optional array of property names to include in the export. When no paths are provided, all non-optional paths are included.
include
String Array
An array of optional property names to be included in the export.
expand
String Array
An array of reference property names to be expanded in the export.
where
String
Optional query argument to filter the export. See the Where query argument for more details.
afterScript
String
A stringified custom script that will execute after export job completion. This is helpful for logging the completion of exports or sending notifications, etc.
principal
ObjectId
When set, the export runs as this principal. This is helpful when exports need to be limited by acl and when used in conjunction with a path prefix.
prefix
String
When a prefix is present the export can be limited to documents available in a write-through list or nested document array.
get
https://api.dev.medable.com
/your_org_name/v2/exports
List
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/exports",
3
method: "GET",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
}
11
}).done(function(data) {
12
// ...
13
});
Copied!
get
https://api.dev.medable.com
/your_org_name/v2/exports/export_id
Read
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/exports/595d68f40e74ad01008c52df",
3
method: "GET",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
}
11
}).done(function(data) {
12
// ...
13
});
Copied!
post
https://api.dev.medable.com
/your_org_name/v2/exports
Create
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/exports",
3
method: "POST",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
},
11
data: {
12
{
13
"label": "My Export",
14
"format": "text/csv",
15
"objects": "c_patients",
16
"paths": ["_id", "created", "c_birthdate", "c_gender", "c_name"],
17
"afterScript": "import logger from 'logger';\nlogger.info(script.arguments.err || script.arguments.export);\n"
18
}
19
}
20
}).done(function(data) {
21
// ...
22
});
Copied!
delete
https://api.dev.medable.com/
your_org_name/v2/exports/export_id
Delete
1
$.ajax({
2
url: "https://api.dev.medable.com/example/v2/connections/595d6b5a0e74ad01008c537a",
3
method: "DELETE",
4
dataType : "json",
5
xhrFields: {
6
withCredentials: true
7
},
8
headers: {
9
"Medable-Client-Key": "GsAqlhnIMzrDeD8V2MBQWq"
10
}
11
}).done(function(data) {
12
// ...
13
});
Copied!
Last modified 1mo ago