api
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
api [2017/12/05 13:20] – [Multiple queries exact search with availability] flack | api [2019/08/05 17:53] – flack | ||
---|---|---|---|
Line 40: | Line 40: | ||
Content-Type: | Content-Type: | ||
- | [ | + | { |
- | | + | |
- | "created": "2015-05-18", | + | "next": |
- | " | + | |
- | "download_size_gb": | + | " |
- | " | + | |
- | "entry_count": | + | |
- | "name": "mcule_purchasable_compounds" | + | "entry_count": |
- | }, | + | " |
- | { | + | { |
- | "created": "2015-05-18", | + | |
- | " | + | "file_type": |
- | "download_size_gb": | + | "file_type_display": "2D SDF (sdf.gz)", |
- | " | + | " |
- | "entry_count": | + | |
- | "name": "mcule_in_stock_compounds" | + | { |
- | }, | + | "download_url": |
- | { | + | " |
- | "created": "2015-05-18", | + | " |
- | "description": "Gzipped 2D SDF of in stock compounds with known exact stock amount", | + | " |
- | "download_size_gb": | + | } |
- | "download_url": " | + | ], |
- | "entry_count": | + | " |
- | "name": "mcule_known_stock_amount_compounds" | + | " |
- | | + | |
- | | + | { |
- | "created": "2015-08-20", | + | |
- | "description": "Gzipped 2D SDF of purchasable compounds with known prices", | + | "entry_count": |
- | "download_size_gb": | + | " |
- | "download_url": "https://mcule.s3.amazonaws.com/ | + | { |
- | "entry_count": | + | |
- | "name": "mcule_instant_quotable_compounds" | + | "file_type": |
- | }, | + | "file_type_display": "2D SDF (sdf.gz)", |
- | | + | " |
- | "created": "2014-07-21", | + | |
- | "description": "Gzipped csv (delimiter: tab) of all compounds with mcule ID, standard InChI and InChIKey", | + | { |
- | "download_size_gb": | + | "download_url": "https:// |
- | "download_url": " | + | "file_type": "smiles.gz", |
- | "entry_count": | + | "file_type_display": |
- | "name": "mcule_inchies" | + | "size_mb": |
- | } | + | } |
- | ] | + | ], |
+ | | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Compound details ===== | ||
+ | == Endpoint: == | ||
+ | < | ||
+ | |||
+ | == Example API request: == | ||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | == Request: == | ||
+ | < | ||
+ | GET / | ||
+ | Accept: */* | ||
+ | Accept-Encoding: | ||
+ | </ | ||
+ | |||
+ | == Response: == | ||
+ | < | ||
+ | HTTP/1.1 200 OK | ||
+ | Allow: GET, HEAD, OPTIONS | ||
+ | Content-Encoding: | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | | ||
+ | "formula": "C15H11N3O2S2", | ||
+ | | ||
+ | | ||
+ | "mol": "\n mcule | ||
+ | " | ||
+ | "atoms": | ||
+ | | ||
+ | "ct_bonds": | ||
+ | "h_bond_acceptors": | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | | ||
+ | "rotatable_bonds": | ||
+ | "stereocenters": | ||
+ | | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | | ||
+ | "std_inchi": "InChI=1S/ | ||
+ | "stereo_type": "none", | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== InChIKey lookup ===== | ||
+ | == Endpoint: == | ||
+ | < | ||
+ | |||
+ | == Example API request: == | ||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | == Request: == | ||
+ | < | ||
+ | GET / | ||
+ | Accept: */* | ||
+ | Accept-Encoding: | ||
+ | </ | ||
+ | |||
+ | == Response: == | ||
+ | < | ||
+ | HTTP/1.1 200 OK | ||
+ | Allow: GET, HEAD, OPTIONS | ||
+ | Content-Encoding: | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | " | ||
+ | | ||
+ | | ||
+ | "smiles": | ||
+ | "url": " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Single query search / lookup ===== | ||
+ | == Endpoint: == | ||
+ | < | ||
+ | |||
+ | Where the query can be an mcule ID, SMILES, InChI or InChIKey identifier. | ||
+ | |||
+ | == Example API request: == | ||
+ | < | ||
+ | http ' | ||
+ | </ | ||
+ | |||
+ | == Request: == | ||
+ | < | ||
+ | GET / | ||
+ | Accept: */* | ||
+ | Accept-Encoding: | ||
+ | </ | ||
+ | |||
+ | == Response: == | ||
+ | < | ||
+ | HTTP/1.1 200 OK | ||
+ | Allow: GET, HEAD, OPTIONS | ||
+ | Content-Encoding: | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | " | ||
+ | | ||
+ | | ||
+ | "smiles": "COC(C1SC(C=CC2SC(C3=NC=CC=C3)=NC=2)=NC=1)=O", | ||
+ | " | ||
+ | | ||
+ | ] | ||
+ | } | ||
</ | </ | ||
Line 99: | Line 240: | ||
Protected API endpoints are only accessible if a valid token is provided in the Authorization header of the request. | Protected API endpoints are only accessible if a valid token is provided in the Authorization header of the request. | ||
+ | |||
+ | ===== Compound availability ===== | ||
+ | == Endpoint: == | ||
+ | < | ||
+ | |||
+ | == Example API request: == | ||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | == Request: == | ||
+ | < | ||
+ | GET / | ||
+ | Accept: */* | ||
+ | Accept-Encoding: | ||
+ | Authorization: | ||
+ | </ | ||
+ | |||
+ | == Response: == | ||
+ | < | ||
+ | HTTP/1.1 200 OK | ||
+ | Allow: GET, HEAD, OPTIONS | ||
+ | Content-Encoding: | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Compound prices ===== | ||
+ | == Endpoint: == | ||
+ | < | ||
+ | |||
+ | == Example API request: == | ||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | == Request: == | ||
+ | < | ||
+ | GET / | ||
+ | Accept: */* | ||
+ | Accept-Encoding: | ||
+ | Authorization: | ||
+ | </ | ||
+ | |||
+ | == Response: == | ||
+ | < | ||
+ | HTTP/1.1 200 OK | ||
+ | Allow: GET, HEAD, OPTIONS | ||
+ | Content-Encoding: | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | It returns the best prices for 1mg, 5mg and 10mg amounts by default. | ||
+ | You can specify amounts of your choice in the //amounts// GET parameter: | ||
+ | |||
+ | < | ||
+ | http ' | ||
+ | </ | ||
+ | |||
===== Multiple queries exact search ===== | ===== Multiple queries exact search ===== | ||
Line 143: | Line 378: | ||
" | " | ||
" | " | ||
- | " | + | " |
}, | }, | ||
{ | { | ||
Line 149: | Line 384: | ||
" | " | ||
" | " | ||
- | " | + | " |
}, | }, | ||
{ | { | ||
Line 155: | Line 390: | ||
" | " | ||
" | " | ||
- | " | + | " |
}, | }, | ||
{ | { | ||
Line 161: | Line 396: | ||
" | " | ||
" | " | ||
- | " | + | " |
} | } | ||
] | ] | ||
Line 213: | Line 448: | ||
" | " | ||
" | " | ||
- | " | + | " |
}, | }, | ||
{ | { | ||
Line 224: | Line 459: | ||
" | " | ||
" | " | ||
- | " | + | " |
}, | }, | ||
{ | { | ||
Line 235: | Line 470: | ||
" | " | ||
" | " | ||
- | " | + | " |
}, | }, | ||
{ | { | ||
Line 246: | Line 481: | ||
" | " | ||
" | " | ||
- | " | + | " |
} | } | ||
] | ] | ||
} | } | ||
</ | </ | ||
+ | |||
+ | |||
+ | ===== Quote Request API ===== | ||
+ | |||
+ | Available soon... | ||
+ | |||
+ | == Endpoint: == | ||
+ | < | ||
+ | |||
+ | == Example API request: == | ||
+ | < | ||
+ | echo ' | ||
+ | </ | ||
+ | |||
+ | Mandatory fields: | ||
+ | * **mcule_ids**: | ||
+ | * **customer_first_name**: | ||
+ | * **customer_last_name**: | ||
+ | * **delivery_country**: | ||
+ | |||
+ | Optional fields: | ||
+ | * **amount**: Preferred amount per molecule (mg); default: 1 | ||
+ | * **min_amount**: | ||
+ | |||
+ | == Request: === | ||
+ | < | ||
+ | POST / | ||
+ | Accept: application/ | ||
+ | Accept-Encoding: | ||
+ | Authorization: | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | ], | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | == Response: === | ||
+ | < | ||
+ | HTTP/1.1 201 CREATED | ||
+ | Allow: GET, POST, HEAD, OPTIONS | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Quote Request Status API ===== | ||
+ | |||
+ | Available soon... | ||
+ | |||
+ | Since generating a quote request can take some time it is an asynchronous process. You can query the status of a quote request by calling the detail API endpoint of the quote request. It is returned in the **api_url** field when you create the quote request. You can also use the **id** field to construct the API call. YOu can check the **state** field of the response whether the async quote request processing is finished. | ||
+ | |||
+ | States: | ||
+ | * **10 / Pending**: The quote query is queued but the processing has not started yet. | ||
+ | * **20 / Running**: The processing of the quote query is in progress. | ||
+ | * **30 / Done**: The processing of the quote query is finished. For one quote request query we might generate multiple quotes (this is what we call a group) or it is also possible that we could not generate any quotes for a particular quote request. If there are quotes they will appear under the **group** field where the **quotes** field contains a list of the generated quotes and some basic info about them. You can get detailed data of a particular quote by calling the endpoint specified in the **api_url** field. | ||
+ | * **40 / Error**: An error happened during the processing of the quote query. | ||
+ | |||
+ | Following the above example where the ID of the quote request is //15029// we query the status of the quote request: | ||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | == Request: === | ||
+ | |||
+ | < | ||
+ | GET / | ||
+ | Accept: */* | ||
+ | Accept-Encoding: | ||
+ | Authorization: | ||
+ | |||
+ | == Response: === | ||
+ | < | ||
+ | HTTP/1.1 200 OK | ||
+ | Allow: GET, HEAD, OPTIONS | ||
+ | Connection: keep-alive | ||
+ | Content-Encoding: | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | 346209969 | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | As you can see from the result we could generate 3 different quotes for the query. A "Best price" quote, a " | ||
+ | |||
+ | ===== Quote API ===== | ||
+ | |||
+ | Available soon... | ||
+ | |||
+ | In order to get the detailed data of an individual quote, you can query the following endpoint. | ||
+ | |||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | == Request: === | ||
+ | < | ||
+ | GET / | ||
+ | Accept: */* | ||
+ | Accept-Encoding: | ||
+ | Authorization: | ||
+ | </ | ||
+ | |||
+ | == Response: === | ||
+ | < | ||
+ | HTTP/1.1 200 OK | ||
+ | Allow: GET, HEAD, OPTIONS | ||
+ | Content-Encoding: | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ |
api.txt · Last modified: 2024/05/10 08:12 by bkovats