Information submitted through the support site is private but is not hosted within your secure CDD Vault. Please do not include sensitive intellectual property in your support requests.

Files [GET, POST, DELETE]

API calls related to file objects:

Retrieve

Create

Delete

Retrieve

Return a single file

GET /api/v1/vaults/<vault_id>/files/<file_id>

Note: The contents are base64 encoded

 

Example 

curl -H "X-CDD-Token: $TOKEN" -X GET "https://app.collaborativedrug.com/api/v1/vaults/<vault_id>/files/<file_id>"

Returns:

{
  "id": 1069448031,
  "class": "uploaded file",
  "name": "tmp.txt",
  "mime_type":
  {
    "synonyms": [],
    "symbol": "text",
    "string": "text/plain",
    "hash": -1147906696977776415
  },
"character_set": "US-ASCII", "contents": "VGhpcyBpcyBhIGZpbGUK" }

Following this up with:

echo VGhpcyBpcyBhIGZpbGUK | base64 -D

Returns:

This is a file

Note: "This is a file" is the actual content of this text file

 

Create

Attach a file to an object (Run, Molecule or Protocol)

POST /api/v1/vaults/<vault_id>/files

 

Example  

curl -H "X-CDD-Token: $TOKEN" -X POST --form "file=@C:\files\<file_name>" --form "resource_class=run" --form "resource_id=<run_id>" "https://app.collaborativedrug.com/api/v1/vaults/<vault_id>/files"

Returns:

{
   "id": "1069448044"
   "name": "<file_name>"
}

 Note: Additional allowed values for resource_class are "molecule" and "protocol".

 

Delete

Delete a file attachment

DELETE /api/v1/vaults/<vault_id>/files/<file_id>

Deletes a single file.

 

Example  

curl -H "X-CDD-Token: $TOKEN" -X DELETE "https://app.collaborativedrug.com/api/v1/vaults/<vault_id>/files/<file_id>"

Returns:

{
      "message": "File with ID <file_id> has been destroyed"
}