API calls related to collection objects:
Retrieve
GET /api/v1/vaults/<vault_id>/collections/<id>
Get a single collection.
Query Parameters (optional):
projects |
Comma-separated list of project ids Collection's project must be included for a vault_collection |
GET /api/v1/vaults/<vault_id>/collections
Get all collections. The molecule ids are not returned by default.
Query Parameters (all optional):
collections |
Comma separated list of ids Cannot be used with Date and Type parameters |
async |
Boolean If true, do an asynchronous export (see Async Export) Use for large data sets. This is recommended any time you want to download more than page_size results. Note: any page_size parameter used in an API GET call that also uses the async=true parameter will be ignored. The GET call will return all valid data for the given GET call. |
only_ids |
Boolean If true, only the Collection IDs are returned, allowing for a smaller and faster response. (Async should still be used when many IDs are expected.)
Note: any Default: false |
include_molecule_ids |
Boolean If true, the molecule ids will be returned as an array using the molecules JSON key.Default: false |
created_before |
Date (YYYY-MM-DDThh:mm:ss±hh:mm) |
created_after |
Date (YYYY-MM-DDThh:mm:ss±hh:mm) |
modified_before |
Date (YYYY-MM-DDThh:mm:ss±hh:mm) |
modified_after |
Date (YYYY-MM-DDThh:mm:ss±hh:mm) |
offset |
The index of the first object actually returned. Defaults to 0. |
page_size |
The maximum number of objects to return in this call. Default is 50, maximum is 1000. If the response exceeds the page_size , we strongly recommend using the async option instead of downloading multiple chunks. Note: any page_size parameter used in an API GET call that also uses the async=true parameter will be ignored. The GET call will return all valid data for the given GET call. |
projects |
Comma-separated list of project ids Defaults to all available projects Limits scope of query |
type |
Comma-separated list of collection types to return. Possible options are user_collection (private) and vault_collection (shared with project members). |
Example
curl -H "X-CDD-Token: $TOKEN" -X GET "https://app.collaborativedrug.com/api/v1/vaults/<vault_id>/collections/<collection_id>"
Returns:
{
"id": <collection_id>,
"class": "user collection",
"created_at": "2023-06-29T21:06:15.818Z",
"modified_at": "2023-06-29T21:06:15.818Z",
"molecules": [1,2],
"name": "My Collection",
"owner": "Jacob Bloom"
}
Create
POST /api/v1/vaults/<vault_id>/collections
Create a new collection.
Parameters
name |
The name of the collection. Required. |
project |
The project with which the vault collection will be associated. If omitted, a user collection (private) will be created. |
overwrite |
Boolean If the name conflicts with an existing collection, overwrite the original. Default: false |
molecules |
Array of molecule ids to add to the collection. Optional. |
Example
curl -H "X-CDD-Token: $TOKEN" -X POST "https://app.collaborativedrug.com/api/v1/vaults/<vault_id>/collections?name=<collection_name>"
Returns:
{
"id": 1,
"class": "user collection",
"created_at": "2023-06-29T21:06:15.818Z",
"modified_at": "2023-06-29T21:06:15.818Z",
"name": <collection_name>,
"owner": "Jacob Bloom"
}
Update
PUT /api/v1/vaults/<vault_id>/collections/<collection_id>
Add molecules to a collection.
There is no mechanism for removing a Molecule from an existing Collection via the API. The workflow to achieve this would be to:
- retrieve the MoleculeIDs in a current Collection,
- delete the existing Collection, and
- create a new Collection leaving out the Molecule ID(s) you wish to remove.
Parameters
molecules |
Array of molecule ids to add to the collection. |
Example
curl -H "X-CDD-Token: $TOKEN" -X POST "https://app.collaborativedrug.com/api/v1/vaults/<vault_id>/collections/<collection_id>?molecules=1,2"
Returns:
{
"id": <collection_id>,
"class": "user collection",
"created_at": "2023-06-28T21:06:15.818Z",
"modified_at": "2023-06-29T21:08:45.858Z",
"molecules": [1,2],
"name": <collection_name>,
"owner": "Jacob Bloom"
}
Delete
DELETE /api/v1/vaults/<vault_id>/collections/<id>
Delete a collection.
Example
curl -H "X-CDD-Token: $TOKEN" -X DELETE "https://app.collaborativedrug.com/api/v1/vaults/<vault_id>/collections/<collection_id>"
Returns:
{
"message": "Object has been destroyed"
}