API calls related to export objects:
For any call made with the parameter async=true and for all saved search retrievals, you need to use the following steps to retrieve the status of your exports.
When retrieving large data sets (i.e. larger than the maximum page size), consider doing an asynchronous request. This allows you to download all requested data in one go.
A typical response for async requests is:
{
"id": 18765',
"status": "new"
}
Check All Current Exports
Check how many async API export tasks are currently running and see the current status of the user's queue. The endpoint does not accept any normal API parameters and lists all of a user's exports, including any exports initiated via the GUI/front-end.
GET /api/v1/vaults/<vault_id>/exports;
This call returns an array of all API and user-initiated active exports. Once an export is complete or cancelled, it will no longer show in the list.
Note: This GET Exports API call will return ALL exports across all Vaults applicable to the API Token specified, regardless of the Vault ID used in the API url. When using this GET Exports API call to retrieve a list of exports to delete, the exact/specific Vault ID for each export must be used in the subsequent DELETE Exports call.
Check Export Status
Check on the status of your export task. Repeat this call every 5-10 seconds (suggested interval) until the status is “finished”
GET /api/v1/vaults/<vault_id>/export_progress/<export_id>
Response:
Status should be one of:
new
started
finished
If it is any other value, something has gone wrong with your export.
Example:
curl -H "X-CDD-Token: $TOKEN" 'https://app.collaborativedrug.com/api/v1/vaults/23/export_progress/18765'
Result:
{
"id": 18765',
"status": "finished"
}
Cancel Export
Cancels an export if possible
DELETE /api/v1/vaults/<vault_id>/exports/<export_id>
Response:
Status should be one of:
canceled
If it is any other value, something has gone wrong with canceling your export.
HTTP code 200 means the export was canceled
HTTP code 405 means the export was not in a cancelable state (Note: It may have already been canceled)
Example:
curl -H "X-CDD-Token: $TOKEN" -X DELETE 'https://app.collaborativedrug.com/api/v1/vaults/23/exports/18765'
Result:
{
"id": 18765',
"status": "canceled"
}
Download Data
Once the file is ready (when its status “finished”), you can download the data through this URL:
GET /api/v1/vaults/<vault_id>/exports/<export_id>
Response:
File contents of the saved search export in whatever format was requested or the JSON of the async request.
If the export is not ready, the server will return HTTP status code 403 (Forbidden) and a JSON response corresponding with Check Export Status.
Example:
curl
-H "X-CDD-Token: $TOKEN"
'https://app.collaborativedrug.com/api/v1/vaults/23/exports/18765'
Result:
Molecule Name,CDD Number,Arginine kinase inhibition: RFU (rfu)
Benzene,CDD-1,0.17