API calls related to batch objects:
Retrieve
GET /api/v1/vaults/<vault_id>/batches/<id>
Get a single batch.
GET /api/v1/vaults/<vault_id>/batches
Get a collection of batches.
Query Parameters (all optional):
batches |
Comma separated list of ids Cannot be used with other 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. |
|
no_structures |
Boolean If true, omit structure representations for a smaller and faster response. Default: false |
|
include_original_structures |
Boolean If true, include the original user defined structure for each molecule. Independent of no_structures Default: false |
|
only_ids |
Boolean
Note: any
|
|
only_molecule_ids |
Boolean If true, the full Batch details are still returned but the Molecule-level information is left out of the JSON results. (Only the IDs of the Molecules are still included.) 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) | |
molecule_created_before |
Date (YYYY-MM-DDThh:mm:ss±hh:mm) | |
molecule_created_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 |
|
data_sets |
Comma-separated list of public dataset ids Defaults to no data sets Limits scope of query |
|
molecule_batch_identifier |
A Molecule-Batch ID used to query the Vault. | |
molecule_fields |
Array of Molecule field names to include in the resulting JSON | |
batch_fields |
Array of Batch field names to include in the resulting JSON. Use this parameter to limit the number of Batch UDF Fields to return | |
fields_search |
Array of Batch field names & values Used to filter Batches returned based on query values |
Note: This parameter is used for searching across the custom user-defined Batch fields created by your Vault Administrator. Special Vault fields like Molecule-Batch ID cannot be searched using this parameter. (For Molecule-Batch ID searching, use the molecule_batch_identifier parameter listed above.) |
Notes on the molecule_fields
and batch_fields
parameters - returning only specified data (udf) fields when making the GET Batches API call
To instruct the GET Batches API call to return ONLY a subset of Molecule/Batch data fields, you may pass the molecule_fields and/or batch_fields parameters as JSON with the GET Batches API call. The JSON passed with the GET Batches API call to achieve this should follow this syntax:
GET https://app.collaborativedrug.com/api/v1/vaults/<vault_id>/batches
As is typical when needing to pass multiple values in a JSON parameter, using the square brackets to pass an array of values is supported. Using this example JSON, for example, will result in 2 Batch fields (ID and Note) to be returned.
GET https://app.collaborativedrug.com/api/v1/vaults/<vault_id>/batches
Notes on molecule_batch_identifier
parameter - passing Molecule-Batch ID query values via the API
To pass a Molecule-Batch ID query values via the API, you must pass the molecule_batch_identifier parameter as JSON with the GET Batches API call. The molecule_batch_identifier section of the JSON passed with the GET Batches API call should follow this syntax:
{ "molecule_batch_identifier": "DEMO-1000210-001",
"no_structures": "true"}
Also note, Batch/Molecule User-Defined Fields are only returned if they have values registered for them. The JSON returned will not include blank UDFs.
Notes on fields_search
parameter - passing Batch field query values via the API
To pass Batch field query values via the API, you must pass the field_search parameters as JSON with the GET Batches API call. The field_search section of the JSON passed with the GET Batches API call should follow this syntax:
{ "fields_search": [
{ “name”: "<Batch udf field name>", ”<value_type>”: “<value to be searched” },
{ “name”: "<Batch udf field name>", ”<value_type>”: “<value to be searched” }]
}
The allowed values for value_type are:
- text_value,
- float_value
- date_value
As an example, the JSON below will search for Batches created after the date specified that have a Place value of Graceland CRO and an Initial Amount value of 100. Since the no_structure (true) and async (false) parameters are also included, no structural information is returned and the API call is not performed in the background.
GET https://app.collaborativedrug.com/api/v1/vaults/<vault_id>/batches
Notes on Date/Time Formats
The CDD Vault API accepts ISO 8601 date/time formats in any API call that allows a date-type parameter. For example, the full date and timestamp may be used in GET calls that support a date parameter. You may still simply provide a date-only parameter like "created_after=2020-05-20".
You may also specify a date + timestamp, like "created_after= 2020-05-20 14:53:12", to indicate "20 May 2020 14:53:12 PDT" (PDT is based on the user's time zone setting). The timestamp portion can also include a UTC (Coordinated Universal Time) offset, like "created_after= 2020-05-27T14:48:40-07:00" which indicates that the time specified is -7 hours from the UTC time.
Example 1 - Search by Batch fields
curl -H "X-CDD-Token: $TOKEN" -H "Content-Type: application/json" -X GET -d "@BatchSearch.json" https://app.collaborativedrug.com/api/v1/vaults/4493/batches
File BatchSearch.json:
{
"created_after":"2022-03-10",
"no_structures":"true",
"fields_search": [{"name": "Place", "text_value": "Graceland CRO"},
{"name": "Date", "date_value": "2022-03-15"},
{"name": "External Identifier", "text_value": "Grace-10-005"},
{"name": "Purity", "float_value": 95}],
"async": false
}
Returns:
{
"count": 1,
"offset": 0,
"page_size": 50,
"objects": [
{
"id": 114276274,
"class": "batch",
"created_at": "2022-03-15T18:15:56.000Z",
"modified_at": "2022-05-11T15:01:10.000Z",
"name": "001",
"molecule_batch_identifier": "DEMO-1000211-001",
"owner": "Charlie Weatherall",
"projects": [
{
"name": "CRO Project",
"id": 7090
}
],
"molecule": {
"id": 107763291,
"class": "molecule",
"created_at": "2022-03-15T18:15:56.000Z",
"modified_at": "2022-05-11T15:01:10.000Z",
"name": "DEMO-1000211",
"synonyms": [
"DEMO-1000211"
],
"registration_type": "CHEMICAL_STRUCTURE",
"projects": [
{
"name": "CRO Project",
"id": 7090
}
],
"owner": "Charlie Weatherall"
},
"salt_name": "Hydrochloride",
"solvent_of_crystallization_name": "H2O",
"formula_weight": 252.79500000000002,
"batch_fields": {
"Date": "2022-03-15",
"Person": "Charlie Weatherall",
"Vendor": "Graceland CRO",
"External Identifier": "Grace-10-005",
"Place": "Graceland CRO",
"Purity": 95.0,
"Inv Initial Amount": 100.0,
"Inv Current Amount": 100.0
},
"stoichiometry": {
"core_count": 1,
"salt_count": 1,
"solvent_of_crystallization_count": 1
}
}
]
}
Example 2- Return a single Batch by ID
Note: the use of parameters within the GET Batches url is obsolete - moving forward, create a JSON file containing the parameters you wish to submit with the GET Batches API call (see Example 1 above)
curl -H "X-CDD-Token: $TOKEN" https://app.collaborativedrug.com/api/v1/vaults/489978881/batches/136660530
Returns:
{
"id": 136660530,
"class": "batch",
"owner": "Super User",
"created_at": "2007-02-04",
"modified_at": "2007-12-31",
"projects": [
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"molecule": {
"id": 927454016,
"class": "molecule",
"name": "Taurine",
"synonyms": [
"Taurine"
],
"projects": [
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"collections": [
{
"name": "super user hits",
"id": 90769562
}
],
"owner": "Super User",
"created_at": "2010-11-17",
"modified_at": "2010-11-17",
"smiles": "NCCS(O)(=O)=O",
"cxsmiles": "NCCS(O)(=O)=O",
"inchi": "InChI=1S/C2H7NO3S/c3-1-2-7(4,5)6/h1-3H2,(H,4,5,6)",
"inchi_key": "XOAAWQZATWQOTB-UHFFFAOYSA-N",
"iupac_name": "2-aminoethane-1-sulfonic acid",
"molfile": "taurine\n Mrv1770 12111714362D \n\n 7 6 0 0 0 0 999 V2000\n 0.1105 -2.0625 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n 0.1105 -1.2375 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 0.0000 0.0000 S 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 0.8250 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1.6500 -0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0 0\n 2 3 1 0 0 0 0\n 3 4 1 0 0 0 0\n 4 5 1 0 0 0 0\n 4 6 2 0 0 0 0\n 4 7 2 0 0 0 0\nM END\n",
"molecular_weight": 125.14,
"log_p": -2.61469,
"log_d": -2.61939,
"log_s": 0.996488,
"num_h_bond_donors": 2,
"num_h_bond_acceptors": 4,
"num_rule_of_5_violations": 0,
"formula": "C2H7NO3S",
"isotope_formula": "C2H7NO3S",
"dot_disconnected_formula": "C2H7NO3S",
"p_k_a": -1.49,
"p_k_a_type": "Acidic",
"exact_mass": 125.014664263,
"heavy_atom_count": 7,
"composition": "C (19.2%), H (5.64%), N (11.19%), O (38.35%), S (25.62%)",
"isotope_composition": "C (19.2%), H (5.64%), N (11.19%), O (38.35%), S (25.62%)",
"topological_polar_surface_area": 80.39,
"num_rotatable_bonds": 2,
"cns_mpo_score": 4.82803,
"fsp3": 1
}
}
Example 3 - Return Batches created before a specified date
Note: the use of parameters within the GET Batches url is obsolete - moving forward, create a JSON file containing the parameters you wish to submit with the GET Batches API call (see Example 1 above)
curl -H "X-CDD-Token: $TOKEN" https://app.collaborativedrug.com/api/v1/vaults/489978881/batches?created_before=2017-12-31
Returns:
{
"count": 9,
"offset": 0,
"page_size": 50,
"objects": [
{
"id": 57473786,
"class": "batch",
"owner": "Full-Access User",
"created_at": "2007-02-04",
"modified_at": "2007-12-31",
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
}
],
"molecule": {
"id": 9,
"class": "molecule",
"name": "structureless",
"synonyms": [
"structureless"
],
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
}
],
"collections": [
{
"name": "all",
"id": 557113845
}
],
"owner": "Full-Access User",
"created_at": "1999-01-01",
"modified_at": "1999-01-01"
}
},
{
"id": 136660530,
"class": "batch",
"owner": "Super User",
"created_at": "2007-02-04",
"modified_at": "2007-12-31",
"projects": [
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"molecule": {
"id": 927454016,
"class": "molecule",
"name": "Taurine",
"synonyms": [
"Taurine"
],
"projects": [
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"collections": [
{
"name": "super user hits",
"id": 90769562
}
],
"owner": "Super User",
"created_at": "2010-11-17",
"modified_at": "2010-11-17",
"smiles": "NCCS(O)(=O)=O",
"cxsmiles": "NCCS(O)(=O)=O",
"inchi": "InChI=1S/C2H7NO3S/c3-1-2-7(4,5)6/h1-3H2,(H,4,5,6)",
"inchi_key": "XOAAWQZATWQOTB-UHFFFAOYSA-N",
"iupac_name": "2-aminoethane-1-sulfonic acid",
"molfile": "taurine\n Mrv1770 12111714502D \n\n 7 6 0 0 0 0 999 V2000\n 0.1105 -2.0625 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n 0.1105 -1.2375 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 0.0000 0.0000 S 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 0.8250 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1.6500 -0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0 0\n 2 3 1 0 0 0 0\n 3 4 1 0 0 0 0\n 4 5 1 0 0 0 0\n 4 6 2 0 0 0 0\n 4 7 2 0 0 0 0\nM END\n",
"molecular_weight": 125.14,
"log_p": -2.61469,
"log_d": -2.61939,
"log_s": 0.996488,
"num_h_bond_donors": 2,
"num_h_bond_acceptors": 4,
"num_rule_of_5_violations": 0,
"formula": "C2H7NO3S",
"isotope_formula": "C2H7NO3S",
"dot_disconnected_formula": "C2H7NO3S",
"p_k_a": -1.49,
"p_k_a_type": "Acidic",
"exact_mass": 125.014664263,
"heavy_atom_count": 7,
"composition": "C (19.2%), H (5.64%), N (11.19%), O (38.35%), S (25.62%)",
"isotope_composition": "C (19.2%), H (5.64%), N (11.19%), O (38.35%), S (25.62%)",
"topological_polar_surface_area": 80.39,
"num_rotatable_bonds": 2,
"cns_mpo_score": 4.82803,
"fsp3": 1
}
},
{
"id": 145175681,
"class": "batch",
"owner": "Full-Access User",
"created_at": "2007-02-04",
"modified_at": "2007-12-31",
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
}
],
"molecule": {
"id": 7,
"class": "molecule",
"name": "Miconazole",
"synonyms": [
"Miconazole"
],
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
}
],
"collections": [
{
"name": "all",
"id": 557113845
}
],
"owner": "Full-Access User",
"created_at": "1999-01-01",
"modified_at": "1999-01-01",
"smiles": "ClC1=CC=C(COC(CN2C=CN=C2)C2=CC=C(Cl)C=C2Cl)C(Cl)=C1",
"cxsmiles": "ClC1=CC=C(COC(CN2C=CN=C2)C2=CC=C(Cl)C=C2Cl)C(Cl)=C1 |c:10,12,20,25,t:1,3,15,17|",
"inchi": "InChI=1S/C18H14Cl4N2O/c19-13-2-1-12(16(21)7-13)10-25-18(9-24-6-5-23-11-24)15-4-3-14(20)8-17(15)22/h1-8,11,18H,9-10H2",
"inchi_key": "BYBLEWFAAKGYCD-UHFFFAOYSA-N",
"iupac_name": "1-[2-(2,4-dichlorophenyl)-2-[(2,4-dichlorophenyl)methoxy]ethyl]-1H-imidazole",
"molfile": "\n Mrv1770 12111714502D \n\n 25 27 0 0 0 0 999 V2000\n -1.4289 0.8250 0.0000 Cl 0 0 0 0 0 0 0 0 0 0 0 0\n -0.7145 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 -1.6500 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 2.1434 -2.0625 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2.8579 -1.6500 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 3.5724 -2.0625 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n 4.3260 -1.7269 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 4.8781 -2.3400 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 4.4656 -3.0545 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n 3.6586 -2.8830 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2.1434 -2.8875 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2.8579 -3.3000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2.8579 -4.1250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2.1434 -4.5375 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2.1434 -5.3625 0.0000 Cl 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 -4.1250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 -3.3000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 -2.8875 0.0000 Cl 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 -1.6500 0.0000 Cl 0 0 0 0 0 0 0 0 0 0 0 0\n -0.7145 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0 0\n 2 3 2 0 0 0 0\n 3 4 1 0 0 0 0\n 4 5 2 0 0 0 0\n 5 6 1 0 0 0 0\n 6 7 1 0 0 0 0\n 7 8 1 0 0 0 0\n 8 9 1 0 0 0 0\n 9 10 1 0 0 0 0\n 10 11 1 0 0 0 0\n 11 12 2 0 0 0 0\n 12 13 1 0 0 0 0\n 13 14 2 0 0 0 0\n 10 14 1 0 0 0 0\n 8 15 1 0 0 0 0\n 15 16 2 0 0 0 0\n 16 17 1 0 0 0 0\n 17 18 2 0 0 0 0\n 18 19 1 0 0 0 0\n 18 20 1 0 0 0 0\n 20 21 2 0 0 0 0\n 15 21 1 0 0 0 0\n 21 22 1 0 0 0 0\n 5 23 1 0 0 0 0\n 23 24 1 0 0 0 0\n 23 25 2 0 0 0 0\n 2 25 1 0 0 0 0\nM END\n",
"molecular_weight": 416.12,
"log_p": 5.95637,
"log_d": 5.92051,
"log_s": -6.08948,
"num_h_bond_donors": 0,
"num_h_bond_acceptors": 2,
"num_rule_of_5_violations": 1,
"formula": "C18H14Cl4N2O",
"isotope_formula": "C18H14Cl4N2O",
"dot_disconnected_formula": "C18H14Cl4N2O",
"p_k_a": 6.48,
"p_k_a_type": "Basic",
"exact_mass": 413.9860239,
"heavy_atom_count": 25,
"composition": "C (51.96%), H (3.39%), Cl (34.08%), N (6.73%), O (3.84%)",
"isotope_composition": "C (51.96%), H (3.39%), Cl (34.08%), N (6.73%), O (3.84%)",
"topological_polar_surface_area": 27.05,
"num_rotatable_bonds": 6,
"cns_mpo_score": 2.95164,
"fsp3": 0.166667
}
},
{
"id": 373670577,
"class": "batch",
"owner": "Super User",
"created_at": "2007-02-04",
"modified_at": "2007-12-31",
"projects": [
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"molecule": {
"id": 971541720,
"class": "molecule",
"name": "Secret",
"synonyms": [
"Secret"
],
"projects": [
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"owner": "Super User",
"created_at": "2010-11-17",
"modified_at": "2010-11-17"
}
},
{
"id": 618771089,
"class": "batch",
"name": "KGB-51AD88",
"owner": "Full-Access User",
"created_at": "2007-02-04",
"modified_at": "2007-12-31",
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
}
],
"molecule": {
"id": 3,
"class": "molecule",
"name": "Cyanide",
"synonyms": [
"Cyanide"
],
"cdd_registry_number": 3,
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
}
],
"collections": [
{
"name": "super user hits",
"id": 90769562
},
{
"name": "all",
"id": 557113845
}
],
"owner": "Full-Access User",
"created_at": "1999-01-01",
"modified_at": "1999-01-01",
"smiles": "C#N",
"cxsmiles": "C#N",
"inchi": "InChI=1S/CHN/c1-2/h1H",
"inchi_key": "LELOWRISYMNNSU-UHFFFAOYSA-N",
"iupac_name": "formonitrile",
"molfile": "\n Mrv1770 12111714502D \n\n 2 1 0 0 0 0 999 V2000\n 0.8250 0.0000 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 3 0 0 0 0\nM END\n",
"molecular_weight": 27.026,
"log_p": -0.346198,
"log_d": -0.339047,
"log_s": 0.321662,
"num_h_bond_donors": 0,
"num_h_bond_acceptors": 1,
"num_rule_of_5_violations": 0,
"formula": "CHN",
"isotope_formula": "CHN",
"dot_disconnected_formula": "CHN",
"p_k_a": 9.5,
"p_k_a_type": "Acidic",
"exact_mass": 27.010899036,
"heavy_atom_count": 2,
"composition": "C (44.44%), H (3.73%), N (51.83%)",
"isotope_composition": "C (44.44%), H (3.73%), N (51.83%)",
"topological_polar_surface_area": 23.79,
"num_rotatable_bonds": 0,
"cns_mpo_score": 5.1895,
"fsp3": 0
},
"formula_weight": 27.026
},
{
"id": 700861902,
"class": "batch",
"name": "Will's bottle of benzene",
"owner": "Readadd User",
"created_at": "2007-02-04",
"modified_at": "2007-12-31",
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
},
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"molecule": {
"id": 1,
"class": "molecule",
"name": "Benzene",
"synonyms": [
"Benzene",
"benzene-002"
],
"cdd_registry_number": 1,
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
},
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"collections": [
{
"name": "all",
"id": 557113845
}
],
"owner": "Full-Access User",
"created_at": "1999-01-01",
"modified_at": "1999-01-01",
"smiles": "C1=CC=CC=C1",
"cxsmiles": "C1=CC=CC=C1 |c:0,2,4|",
"inchi": "InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H",
"inchi_key": "UHOVQNZJYSORNB-UHFFFAOYSA-N",
"iupac_name": "benzene",
"molfile": "\n Mrv1770 12111714502D \n\n 6 6 0 0 0 0 999 V2000\n 0.7145 1.2375 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 2 0 0 0 0\n 2 3 1 0 0 0 0\n 3 4 2 0 0 0 0\n 4 5 1 0 0 0 0\n 5 6 2 0 0 0 0\n 1 6 1 0 0 0 0\nM END\n",
"molecular_weight": 78.114,
"log_p": 1.97325,
"log_d": 1.97325,
"log_s": -1.26596,
"num_h_bond_donors": 0,
"num_h_bond_acceptors": 0,
"num_rule_of_5_violations": 0,
"formula": "C6H6",
"isotope_formula": "C6H6",
"dot_disconnected_formula": "C6H6",
"exact_mass": 78.0469501932,
"heavy_atom_count": 6,
"composition": "C (92.26%), H (7.74%)",
"isotope_composition": "C (92.26%), H (7.74%)",
"topological_polar_surface_area": 0,
"num_rotatable_bonds": 0,
"cns_mpo_score": 5,
"fsp3": 0,
"udfs": {
"Color": "colorless",
"Taste": "very bitter",
"Smell": "sweet"
}
},
"formula_weight": 78.114,
"batch_fields": {
"Date": "2006-01-01",
"Person": "Will",
"Place": "The kitchen",
"Note": "50% water"
}
},
{
"id": 787637732,
"class": "batch",
"name": "Sigma-Aldrich #2451",
"owner": "Full-Access User",
"created_at": "2007-02-04",
"modified_at": "2007-12-31",
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
}
],
"molecule": {
"id": 2,
"class": "molecule",
"name": "Water",
"synonyms": [
"Water"
],
"cdd_registry_number": 2,
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
}
],
"collections": [
{
"name": "super user hits",
"id": 90769562
},
{
"name": "all",
"id": 557113845
}
],
"owner": "Full-Access User",
"created_at": "1999-01-01",
"modified_at": "1999-01-01",
"smiles": "O",
"cxsmiles": "O",
"inchi": "InChI=1S/H2O/h1H2",
"inchi_key": "XLYOFNOQVPJJNP-UHFFFAOYSA-N",
"iupac_name": "water",
"molfile": "\n Mrv1770 12111714502D \n\n 1 0 0 0 0 0 999 V2000\n 0.0000 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\nM END\n",
"molecular_weight": 18.015,
"log_p": -0.652,
"log_d": -0.652,
"log_s": 0.530744,
"num_h_bond_donors": 1,
"num_h_bond_acceptors": 1,
"num_rule_of_5_violations": 0,
"formula": "H2O",
"isotope_formula": "H2O",
"dot_disconnected_formula": "H2O",
"p_k_a": 15.7,
"p_k_a_type": "Acidic",
"exact_mass": 18.010564684,
"heavy_atom_count": 1,
"composition": "H (11.19%), O (88.81%)",
"isotope_composition": "H (11.19%), O (88.81%)",
"topological_polar_surface_area": 25.3,
"num_rotatable_bonds": 0,
"cns_mpo_score": 5.09833,
"udfs": {
"Literature Reference": "Aqueous et al. 2009",
"Description": "water is the source of life"
}
},
"formula_weight": 18.015,
"batch_fields": {
"Person": "Will",
"Place": "The kitchen",
"Date": "2007-02-04",
"Note": "note taken"
}
},
{
"id": 812057525,
"class": "batch",
"owner": "Super User",
"created_at": "2007-02-04",
"modified_at": "2007-12-31",
"projects": [
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"molecule": {
"id": 246113948,
"class": "molecule",
"name": "Glucose",
"synonyms": [
"Glucose"
],
"projects": [
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"collections": [
{
"name": "super user hits",
"id": 90769562
}
],
"owner": "Super User",
"created_at": "2010-11-17",
"modified_at": "2010-11-17",
"smiles": "OC[C@H]1OC(O)[C@H](O)[C@@H](O)[C@@H]1O",
"cxsmiles": "OC[C@H]1OC(O)[C@H](O)[C@@H](O)[C@@H]1O",
"inchi": "InChI=1S/C6H12O6/c7-1-2-3(8)4(9)5(10)6(11)12-2/h2-11H,1H2/t2-,3-,4+,5-,6?/m1/s1",
"inchi_key": "WQZGKKKJIJFFOK-GASJEMHNSA-N",
"iupac_name": "(3R,4S,5S,6R)-6-(hydroxymethyl)oxane-2,3,4,5-tetrol",
"molfile": "glucose\n Mrv1770 12111714502D \n\n 12 12 0 0 1 0 999 V2000\n 0.0000 2.4750 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 2.0625 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 1.2375 0.0000 C 0 0 1 0 0 0 0 0 0 0 0 0\n 1.4289 0.8250 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2.1434 -0.4125 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 -0.4125 0.0000 C 0 0 2 0 0 0 0 0 0 0 0 0\n 0.7145 -1.2375 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.0000 0.0000 C 0 0 1 0 0 0 0 0 0 0 0 0\n -0.7145 -0.4125 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.8250 0.0000 C 0 0 2 0 0 0 0 0 0 0 0 0\n -0.7145 1.2375 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0 0\n 3 2 1 1 0 0 0\n 3 4 1 0 0 0 0\n 4 5 1 0 0 0 0\n 5 6 1 0 0 0 0\n 5 7 1 0 0 0 0\n 7 8 1 6 0 0 0\n 7 9 1 0 0 0 0\n 9 10 1 1 0 0 0\n 9 11 1 0 0 0 0\n 3 11 1 0 0 0 0\n 11 12 1 6 0 0 0\nM END\n",
"molecular_weight": 180.156,
"log_p": -2.93254,
"log_d": -2.93259,
"log_s": 0.351011,
"num_h_bond_donors": 5,
"num_h_bond_acceptors": 6,
"num_rule_of_5_violations": 0,
"formula": "C6H12O6",
"isotope_formula": "C6H12O6",
"dot_disconnected_formula": "C6H12O6",
"p_k_a": 11.3,
"p_k_a_type": "Acidic",
"exact_mass": 180.063388106,
"heavy_atom_count": 12,
"composition": "C (40%), H (6.71%), O (53.28%)",
"isotope_composition": "C (40%), H (6.71%), O (53.28%)",
"topological_polar_surface_area": 110.38,
"num_rotatable_bonds": 1,
"cns_mpo_score": 4.32067,
"fsp3": 1
}
},
{
"id": 858251680,
"class": "batch",
"name": "Joey's bottle of benzene",
"owner": "Full-Access User",
"created_at": "2010-02-04",
"modified_at": "2010-12-31",
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
}
],
"molecule": {
"id": 1,
"class": "molecule",
"name": "Benzene",
"synonyms": [
"Benzene",
"benzene-002"
],
"cdd_registry_number": 1,
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
},
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"collections": [
{
"name": "all",
"id": 557113845
}
],
"owner": "Full-Access User",
"created_at": "1999-01-01",
"modified_at": "1999-01-01",
"smiles": "C1=CC=CC=C1",
"cxsmiles": "C1=CC=CC=C1 |c:0,2,4|",
"inchi": "InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H",
"inchi_key": "UHOVQNZJYSORNB-UHFFFAOYSA-N",
"iupac_name": "benzene",
"molfile": "\n Mrv1770 12111714502D \n\n 6 6 0 0 0 0 999 V2000\n 0.7145 1.2375 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1.4289 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.7145 -0.4125 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 2 0 0 0 0\n 2 3 1 0 0 0 0\n 3 4 2 0 0 0 0\n 4 5 1 0 0 0 0\n 5 6 2 0 0 0 0\n 1 6 1 0 0 0 0\nM END\n",
"molecular_weight": 78.114,
"log_p": 1.97325,
"log_d": 1.97325,
"log_s": -1.26596,
"num_h_bond_donors": 0,
"num_h_bond_acceptors": 0,
"num_rule_of_5_violations": 0,
"formula": "C6H6",
"isotope_formula": "C6H6",
"dot_disconnected_formula": "C6H6",
"exact_mass": 78.0469501932,
"heavy_atom_count": 6,
"composition": "C (92.26%), H (7.74%)",
"isotope_composition": "C (92.26%), H (7.74%)",
"topological_polar_surface_area": 0,
"num_rotatable_bonds": 0,
"cns_mpo_score": 5,
"fsp3": 0,
"udfs": {
"Color": "colorless",
"Taste": "very bitter",
"Smell": "sweet"
}
},
"formula_weight": 78.114,
"batch_fields": {
"Date": "2009-01-01",
"Person": "Joey",
"Note": "in between the Jack and the Grey Goose",
"Place": "The bar"
}
}
]
}
Notes on using JSON in environments that do not support writing and attaching temporary JSONs to a GET request
POST Query API Parameter
Passing JSON content in a GET API call is becoming a non-standard way of building REST APIs. As an example, Microsoft doesn't allow sending JSON content with GET requests.
To offer a solution to this limitation, the CDD Vault POST API call now includes a “query” parameter that, when used, will pass the JSON as desired to retrieve data from CDD Vault.
As an example, if you wanted to retrieve Batches that meet a certain set of parameters, the GET Batches API call might resemble this:
GET /api/v1/vaults/<vault_id>/batches
Using JSON written like:
{
"created_after":"2022-01-01",
"projects":"6547",
"no_structures":true
}
If your infrastructure does not support passing JSON parameters with a GET Batches API call, then you may now use a POST API call resembling this:
POST /api/v1/vaults/<vault_id>/batches/query
Using JSON written like:
{
"created_after":"2022-01-01",
"projects":"6547",
"no_structures":true
}
Noteworthy tips:
- Note the “query” parameter is added to the end of the POST url. This allows the POST API call to retrieve data from CDD Vault instead of creating new data (which is the common function of a POST API call)
- This “query” parameter is supported for all POST API calls in CDD Vault that have a corresponding GET API call.
Create
POST /api/v1/vaults/<vault_id>/batches
Creates a new batch.
The body of the POST must contain a JSON structure specifying the molecule attributes. The structure is roughly the same format as what is returned by a GET call but with some restrictions and additions.
The HTTP response contains the full JSON representation of the new batch (as would be returned from a GET).
Allowed JSON keys for batches:
class |
Optional. If present, must be “batch” |
molecule |
See Create Molecule if creating a new molecule in a Vault without a registration system enabled. Use the following when creating a new small molecule:
Also include one of the following when creating a new molecule:
Originally, only tautomer resolution was enabled via the api. For this reason, tautomer_resolution is still an acceptable synonym for duplicate_resolution. If a duplicate, ambiguous OR, or tautomeric structure is detected, the following parameters can be used:
Use the following when the API call is also creating a new Molecule and you want to populate Molecule-level user-defined fields:
Use the following when creating a new amino acid:
Also include one of the following when creating a new amino acid:
Use the following when creating a new nucleotide:
Also include one of the following when creating a new nucleotide:
|
name |
String |
projects |
An array of project ids and/or names |
batch_fields |
Each vault has its own settings on the minimum information required to create a new Batch (for a Vault Administrator, see Settings > Vault > Batch Fields, to change which Batch fields are required). {<batch_field_name>: <batch_field_value>, ... } |
salt_name (Registration Vaults Only) |
A two-letter code or Salt vendor string as listed in the All Available Salts table. The salt is determined automatically when the salt is included in the molecular structure. |
solvent_of_crystallization_name (Registration Vaults Only) |
Name of the solvent. Click here to the view the available solvents |
stoichiometry (Registration Vaults Only) |
{ |
Note that in a registration vault, POST batch is the only way to create a new molecule, since the registration of a new molecule must be accompanied by a first batch. In this case, the JSON describing the batch will include a "molecule" field with detailed information on the new molecule.
Example
curl -H "X-CDD-Token: $TOKEN" -X POST -H "Content-Type: application/json" -d "@data.json" https://app.collaborativedrug.com/api/v1/vaults/489978881/batches
File data.json:
{
"molecule":{"registration_type":"CHEMICAL_STRUCTURE","smiles":"ccc",{"udfs": {
"Color": "Clear",
"Lab ID": "XYZ123"
}
}
},
"projects": [938429932, "Super User Private Stuff"],
"batch_fields": {
"Date": "2017-01-01",
"Person": "Colonel Mustard",
"Place": "Foyer",
"Note": "With a Candlestick"
}
}
Returns:
{
"id": 1043808269,
"class": "batch",
"owner": "Super User",
"created_at": "2017-12-11",
"modified_at": "2017-12-11",
"projects": [
{
"name": "Some Vault Name",
"id": 938429932
},
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"molecule": {
"id": 927454016,
"class": "molecule",
"name": "Taurine",
"synonyms": [
"Taurine"
],
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
},
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"collections": [
{
"name": "super user hits",
"id": 90769562
}
],
"owner": "Super User",
"created_at": "2010-11-17",
"modified_at": "2017-12-11",
"smiles": "NCCS(O)(=O)=O",
"cxsmiles": "NCCS(O)(=O)=O",
"inchi": "InChI=1S/C2H7NO3S/c3-1-2-7(4,5)6/h1-3H2,(H,4,5,6)",
"inchi_key": "XOAAWQZATWQOTB-UHFFFAOYSA-N",
"iupac_name": "2-aminoethane-1-sulfonic acid",
"molfile": "taurine\n Mrv1770 12111716072D \n\n 7 6 0 0 0 0 999 V2000\n 0.1105 -2.0625 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n 0.1105 -1.2375 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 0.0000 0.0000 S 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 0.8250 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1.6500 -0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0 0\n 2 3 1 0 0 0 0\n 3 4 1 0 0 0 0\n 4 5 1 0 0 0 0\n 4 6 2 0 0 0 0\n 4 7 2 0 0 0 0\nM END\n",
"molecular_weight": 125.14,
"log_p": -2.61469,
"log_d": -2.61939,
"log_s": 0.996488,
"num_h_bond_donors": 2,
"num_h_bond_acceptors": 4,
"num_rule_of_5_violations": 0,
"formula": "C2H7NO3S",
"isotope_formula": "C2H7NO3S",
"dot_disconnected_formula": "C2H7NO3S",
"p_k_a": -1.49,
"p_k_a_type": "Acidic",
"exact_mass": 125.014664263,
"heavy_atom_count": 7,
"composition": "C (19.2%), H (5.64%), N (11.19%), O (38.35%), S (25.62%)",
"isotope_composition": "C (19.2%), H (5.64%), N (11.19%), O (38.35%), S (25.62%)",
"topological_polar_surface_area": 80.39,
"num_rotatable_bonds": 2,
"cns_mpo_score": 4.82803,
"fsp3": 1
},
"formula_weight": 125.14,
"batch_fields": {
"Date": "2017-01-01",
"Person": "Colonel Mustard",
"Place": "Foyer",
"Note": "With a Candlestick"
}
}
To manage cases where duplicate, ambiguous OR, or tautomeric structures might be detected when registering new Molecules/Batches, use the "duplicate_resolution" parameter within the Molecule section of the JSON parameters.
- first
- "duplicate_resolution":"first"
- results in a new Batch being registered for the first Molecule detected as a potential match
- new
- "duplicate_resolution":"new"
- results in a new Molecule being registered
- prompt
- "duplicate_resolution":"prompt"
- results in nothing being registered
- potentially matching molecule IDs are returned
Example JSON for use with the POST Batches API call
{ "molecule":
{"registration_type":"CHEMICAL_STRUCTURE",
"smiles":"O=CC(C=O)O",
"duplicate_resolution": "prompt"},
"projects":["Internal Data"] }
Helpful hints:
- The intent of the "duplicate_resolution":"prompt" parameter is to give you the Molecule IDs of the potentially matching structures… then, you can use the POST Batches without the structure, and match on the Molecule ID or Name to register the new Batch of any existing Molecule.
- POST Batches with JSON like this:
{"molecule": {
"Registration_type":"chemical_structure",
"name":"CWS-0005669" },
"projects": ["CW Test"]}
- The "duplicate_resolution":"first" is the default. So, if you leave out the “duplicate_resolution” parameter all together, "duplicate_resolution":"first" is used and a new Batch will be registered for the first Molecule detected as a potential match. (You are not warned that there were duplicate, ambiguous OR, or tautomeric structures detected.)
Example JSON used for registering a new Amino Acid might resemble:
{
"molecule": {"registration_type":"AMINO_ACID","amino_acid":"AAZNRXXNA"},
"projects": ["Test"]
}
Example JSON used for registering a new Nucleotide might resemble:
{
"molecule": {"registration_type":"NUCLEOTIDE","nucleotide":"GATTACA"},
"projects": ["Test"]
}
Update
PUT /api/v1/vaults/<vault_id>/batches/id
Update an existing batch.
See Create for valid fields. (An exception to this is the Molecule field - this PUT Batches call should not be used to update the chemical structure of the parent Molecule - use the PUT Molecules API call to achieve this.) Fields not specified in the JSON are not changed.
To delete a Batch, simply submit with an empty projects array. (For safety/security purposes, Batches which have data associated with them cannot be deleted via this PUT Batches API call. Data (such as rows of readout data in a Protocol Run) must be removed prior to using the PUT Batches API call to delete a Batch.)
Note that the ID for the batch is specified as part of the URL, not in the JSON (the JSON can contain an ID field as long as its value matches the URL).
Examples
curl -H "X-CDD-Token: $TOKEN" -X PUT -H "Content-Type: application/json" -d "@data.json" https://app.collaborativedrug.com/api/v1/vaults/489978881/batches/1043808269
File data.json:
{
"batch_fields": {
"Person": "Mrs. Peacock"
}
}
Returns:
{
"id": 1043808269,
"class": "batch",
"name": "tmp API batch",
"owner": "Super User",
"created_at": "2017-12-11",
"modified_at": "2017-12-11",
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
},
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"molecule": {
"id": 927454016,
"class": "molecule",
"name": "Taurine",
"synonyms": [
"Taurine"
],
"projects": [
{
"name": "McKerrow Vault",
"id": 938429932
},
{
"name": "Super User Private Stuff",
"id": 3870925
}
],
"collections": [
{
"name": "super user hits",
"id": 90769562
}
],
"owner": "Super User",
"created_at": "2010-11-17",
"modified_at": "2017-12-11",
"smiles": "NCCS(O)(=O)=O",
"cxsmiles": "NCCS(O)(=O)=O",
"inchi": "InChI=1S/C2H7NO3S/c3-1-2-7(4,5)6/h1-3H2,(H,4,5,6)",
"inchi_key": "XOAAWQZATWQOTB-UHFFFAOYSA-N",
"iupac_name": "2-aminoethane-1-sulfonic acid",
"molfile": "taurine\n Mrv1770 12111716072D \n\n 7 6 0 0 0 0 999 V2000\n 0.1105 -2.0625 0.0000 N 0 0 0 0 0 0 0 0 0 0 0 0\n 0.1105 -1.2375 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 -0.8250 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 0.0000 0.0000 S 0 0 0 0 0 0 0 0 0 0 0 0\n 0.8250 0.8250 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1.6500 -0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 0.0000 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0\n 1 2 1 0 0 0 0\n 2 3 1 0 0 0 0\n 3 4 1 0 0 0 0\n 4 5 1 0 0 0 0\n 4 6 2 0 0 0 0\n 4 7 2 0 0 0 0\nM END\n",
"molecular_weight": 125.14,
"log_p": -2.61469,
"log_d": -2.61939,
"log_s": 0.996488,
"num_h_bond_donors": 2,
"num_h_bond_acceptors": 4,
"num_rule_of_5_violations": 0,
"formula": "C2H7NO3S",
"isotope_formula": "C2H7NO3S",
"dot_disconnected_formula": "C2H7NO3S",
"p_k_a": -1.49,
"p_k_a_type": "Acidic",
"exact_mass": 125.014664263,
"heavy_atom_count": 7,
"composition": "C (19.2%), H (5.64%), N (11.19%), O (38.35%), S (25.62%)",
"isotope_composition": "C (19.2%), H (5.64%), N (11.19%), O (38.35%), S (25.62%)",
"topological_polar_surface_area": 80.39,
"num_rotatable_bonds": 2,
"cns_mpo_score": 4.82803,
"fsp3": 1
},
"formula_weight": 125.14,
"batch_fields": {
"Date": "2017-01-01",
"Person": "Mrs. Peacock",
"Place": "Foyer",
"Note": "With a Candlestick"
}
}
curl -H "X-CDD-Token: $TOKEN" -X PUT -H "Content-Type: application/json" -d "@data.json" https://app.collaborativedrug.com/api/v1/vaults/489978881/batches/1043808269
File data.json:
{
"projects": []
}
Returns:
{
"message": "Object has been removed from all projects, so it has been deleted"
}