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.

Python scripting language

The following requirements are necessary if you want to use the scripting language Python for your API programming:

Python V2.7.x (or V3.x)

library: "requests" - see this page for details and installation

 

A simple example of looking at a particular molecule (using GET) would look like this:

import requests
base_url = "https://app.collaborativedrug.com/api/v1/vaults/4692/"
headers = {'X-CDD-token':<YOUR TOKEN HERE>"}
url = base_url + "molecules/53874733"
response = requests.request("GET", url, headers=headers)
#to view the status, use: print(response)

#to view the detailed JSON return content:
print(response.json())

 

Another example using POST to create a new compound, respectively a new batch of an existing molecule:

import requests
headers = {'X-CDD-token':<YOUR TOKEN HERE>"}
base_url = "https://app.collaborativedrug.com/api/v1/vaults/4692/"
url = base_url + "batches"
data = { 
    "molecule": {"smiles": "CCCCCO"},
    "projects": ["YourProject"],
    "batch_fields": {
        "Date": "2018-04-15",
        "Vendor":"SomeVendor"  }
}
response = requests.post(url, headers=headers, json=data)

#to view the status, use: print(response)

#to view the detailed JSON return content:
print(response.json())

In this case, the POST would compare to an existing structure with the given smiles string.