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 [2019/08/05 17:47] – flack | api [2019/09/25 17:28] – [Quote - Missing structures] flack | ||
---|---|---|---|
Line 229: | Line 229: | ||
Authentication is currently a token based authentication. | Authentication is currently a token based authentication. | ||
- | If you would like to access our protected API endpoints, please drop us an email at info@mcule.com and we can provide you with a token. | + | If you would like to access our protected API endpoints, please drop us an email at support@mcule.com and we can provide you with a token. |
Once you have a valid token you have to send it in the Authorization header: | Once you have a valid token you have to send it in the Authorization header: | ||
Line 236: | Line 236: | ||
</ | </ | ||
+ | Example: | ||
+ | < | ||
+ | Authorization: | ||
+ | </ | ||
+ | |||
+ | If you have a valid access token you can check it on the [[https:// | ||
====== Protected API endpoints ====== | ====== Protected API endpoints ====== | ||
Line 486: | Line 492: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ===== Compound suppliers public API ===== | ||
+ | |||
+ | You can get some very basic (public) information about our compound suppliers with this API. | ||
+ | |||
+ | == Endpoint: == | ||
+ | < | ||
+ | |||
+ | == Example API request: == | ||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | == Example request: === | ||
+ | < | ||
+ | GET / | ||
+ | Accept: */* | ||
+ | Accept-Encoding: | ||
+ | Authorization: | ||
+ | </ | ||
+ | |||
+ | == Example response: === | ||
+ | < | ||
+ | HTTP/1.1 200 OK | ||
+ | Allow: GET, HEAD, OPTIONS | ||
+ | Connection: keep-alive | ||
+ | Content-Encoding: | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | ], | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | | ||
+ | ... | ||
+ | | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The detail API endpoint is also available on this endpoint: | ||
+ | < | ||
+ | |||
+ | It will return a similar response as the above one but for an individual compound supplier. | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Compound catalogs public API ===== | ||
+ | |||
+ | You can get some very basic (public) information about our compound catalogs with this API. | ||
+ | |||
+ | == Endpoint: == | ||
+ | < | ||
+ | |||
+ | == Example API request: == | ||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | == Example request: === | ||
+ | < | ||
+ | GET / | ||
+ | Accept: */* | ||
+ | Accept-Encoding: | ||
+ | Authorization: | ||
+ | Connection: keep-alive | ||
+ | </ | ||
+ | |||
+ | == Example response: === | ||
+ | < | ||
+ | HTTP/1.1 200 OK | ||
+ | Allow: GET, HEAD, OPTIONS | ||
+ | Connection: keep-alive | ||
+ | Content-Encoding: | ||
+ | Content-Type: | ||
+ | |||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | |||
+ | ... | ||
+ | | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | The detail API endpoint is also available on this endpoint: | ||
+ | < | ||
+ | |||
+ | It will return a similar response as the above one but for an individual compound catalog. | ||
+ | |||
===== Quote Request API ===== | ===== Quote Request API ===== | ||
+ | |||
== Endpoint: == | == Endpoint: == | ||
< | < | ||
Line 498: | Line 631: | ||
Mandatory fields: | Mandatory fields: | ||
- | * **mcule_ids**: | + | * **mcule_ids**: |
- | * **customer_first_name**: | + | * **customer_first_name**: |
- | * **customer_last_name**: | + | * **customer_last_name**: |
- | * **delivery_country**: | + | * **delivery_country**: |
Optional fields: | Optional fields: | ||
- | * **amount**: Preferred amount per molecule (mg); default: 1 | + | * **amount**: Preferred amount per molecule (mg). (default: 1) |
- | * **min_amount**: | + | * **min_amount**: |
+ | * **target_volume**: | ||
+ | * **target_cc**: | ||
+ | * **customer_email**: | ||
+ | * **delivery_time**: | ||
+ | * **purity**: Required minimum purity (%). (default: null) | ||
+ | * **higher_amounts**: | ||
+ | * **item_filters**: | ||
- | == Request: === | + | The **amount** or target concentration-volume pair (**target_volume** and **target_cc**) need to be specified. |
+ | |||
+ | **item_filters** example: | ||
+ | It has to be a data structure where keys are mcule IDs you specified in the **mcule_ids** field. If you specify a key that is not an item in the **mcule_ids** list you should get a validation error (400 Bad Request). | ||
+ | Currently only supplier filtering is supported. You can specify a supplier ID list in the **suppliers** field to restrict product selection of a given item to a list of suppliers. If the list contains only one supplier ID, you restrict the product selection to that particular supplier. To get the ID of a supplier you can use the [[api# | ||
+ | < | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Advanced optional fields: | ||
+ | * **keep_original_salt_form**: | ||
+ | * **keep_original_tautomer_form**: | ||
+ | * **keep_original_stereo_form**: | ||
+ | * **deliver_multiple_salt_forms**: | ||
+ | |||
+ | |||
+ | == Example request: === | ||
< | < | ||
POST / | POST / | ||
Line 531: | Line 691: | ||
</ | </ | ||
- | == Response: === | + | == Example response: === |
< | < | ||
HTTP/1.1 201 CREATED | HTTP/1.1 201 CREATED | ||
Line 553: | Line 713: | ||
" | " | ||
" | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 565: | Line 719: | ||
" | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
- | " | ||
" | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
- | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 593: | Line 736: | ||
===== Quote Request Status API ===== | ===== Quote Request Status API ===== | ||
- | Since generating | + | Since processing |
States: | States: | ||
Line 606: | Line 749: | ||
</ | </ | ||
- | == Request: === | + | == Example request: === |
< | < | ||
Line 613: | Line 756: | ||
Accept-Encoding: | Accept-Encoding: | ||
Authorization: | Authorization: | ||
+ | </ | ||
- | == Response: === | + | == Example response: === |
< | < | ||
HTTP/1.1 200 OK | HTTP/1.1 200 OK | ||
Line 638: | Line 782: | ||
" | " | ||
" | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 651: | Line 789: | ||
" | " | ||
{ | { | ||
- | " | ||
" | " | ||
" | " | ||
Line 667: | Line 804: | ||
" | " | ||
" | " | ||
- | " | ||
- | 346209969 | ||
- | ], | ||
" | " | ||
" | " | ||
Line 689: | Line 823: | ||
" | " | ||
" | " | ||
- | " | ||
" | " | ||
- | " | + | " |
" | " | ||
" | " | ||
}, | }, | ||
{ | { | ||
- | " | ||
" | " | ||
" | " | ||
Line 712: | Line 844: | ||
" | " | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 732: | Line 863: | ||
" | " | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 739: | Line 869: | ||
}, | }, | ||
{ | { | ||
- | " | ||
" | " | ||
" | " | ||
Line 755: | Line 884: | ||
" | " | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 789: | Line 917: | ||
" | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
- | " | ||
" | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
- | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 814: | Line 931: | ||
</ | </ | ||
- | As you can see from the result we could generate 3 different quotes for the query. A "Best price" quote, a " | + | Check for the **group** field. If it is not null, we could generate some quotes for your quote query. |
- | ===== Quote API ===== | + | ===== Quote API ===== |
- | In order to get the detailed data of an individual quote, you can query the following | + | In order to get the detailed data of an individual quote, you can call the detail API endpoint |
< | < | ||
Line 824: | Line 941: | ||
</ | </ | ||
- | == Request: === | + | == Example request: === |
< | < | ||
GET / | GET / | ||
Line 832: | Line 949: | ||
</ | </ | ||
- | == Response: === | + | == Example response: === |
< | < | ||
HTTP/1.1 200 OK | HTTP/1.1 200 OK | ||
Line 840: | Line 957: | ||
{ | { | ||
- | " | ||
" | " | ||
" | " | ||
Line 846: | Line 962: | ||
" | " | ||
{ | { | ||
+ | " | ||
" | " | ||
" | " | ||
" | " | ||
- | " | + | " |
+ | " | ||
" | " | ||
" | " | ||
Line 857: | Line 975: | ||
}, | }, | ||
{ | { | ||
+ | " | ||
" | " | ||
" | " | ||
" | " | ||
" | " | ||
+ | " | ||
" | " | ||
" | " | ||
Line 868: | Line 988: | ||
}, | }, | ||
{ | { | ||
+ | " | ||
" | " | ||
" | " | ||
" | " | ||
" | " | ||
+ | " | ||
" | " | ||
" | " | ||
Line 894: | Line 1016: | ||
{ | { | ||
" | " | ||
+ | " | ||
" | " | ||
" | " | ||
- | " | + | " |
+ | " | ||
+ | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
" | " | ||
+ | " | ||
+ | " | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 910: | Line 1034: | ||
{ | { | ||
" | " | ||
+ | " | ||
" | " | ||
" | " | ||
+ | " | ||
+ | " | ||
" | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
" | " | ||
+ | " | ||
+ | " | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 926: | Line 1052: | ||
{ | { | ||
" | " | ||
+ | " | ||
" | " | ||
" | " | ||
" | " | ||
+ | " | ||
+ | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
" | " | ||
+ | " | ||
+ | " | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 942: | Line 1070: | ||
{ | { | ||
" | " | ||
+ | " | ||
" | " | ||
" | " | ||
" | " | ||
+ | " | ||
+ | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
- | " | + | " |
+ | " | ||
+ | " | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 958: | Line 1088: | ||
{ | { | ||
" | " | ||
+ | " | ||
" | " | ||
" | " | ||
" | " | ||
+ | " | ||
+ | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
" | " | ||
+ | " | ||
+ | " | ||
" | " | ||
- | " | ||
" | " | ||
" | " | ||
} | } | ||
], | ], | ||
- | "missing": [], | + | "missing_mcule_ids": [], |
" | " | ||
" | " | ||
Line 1034: | Line 1166: | ||
" | " | ||
" | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 1046: | Line 1172: | ||
" | " | ||
" | " | ||
- | " | ||
- | " | ||
" | " | ||
- | " | ||
" | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
- | " | ||
- | " | ||
- | " | ||
" | " | ||
" | " | ||
Line 1082: | Line 1197: | ||
" | " | ||
" | " | ||
+ | " | ||
" | " | ||
" | " | ||
Line 1096: | Line 1212: | ||
" | " | ||
" | " | ||
+ | " | ||
" | " | ||
" | " | ||
Line 1110: | Line 1227: | ||
" | " | ||
" | " | ||
+ | " | ||
" | " | ||
" | " | ||
Line 1132: | Line 1250: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | == Fields: === | ||
+ | |||
+ | Where currency is not specified, it is always USD. | ||
+ | |||
+ | * **analytical_services_price**: | ||
+ | * **avg_product_price**: | ||
+ | * **catalog_data**: | ||
+ | * **products_count**: | ||
+ | * **products_price**: | ||
+ | * **effective_price_display**: | ||
+ | * **avg_effective_price**: | ||
+ | * **delivery_time**: | ||
+ | * **quote**: The ID of the quote this catalog level quote data belongs to. | ||
+ | * **coverage_percent**: | ||
+ | * **created**: | ||
+ | * **delivery_days**: | ||
+ | * **delivery_price**: | ||
+ | * **duplicate_count**: | ||
+ | * **extra_handling_price**: | ||
+ | * **group**: | ||
+ | * **id**: The ID of the Instant Quote. | ||
+ | * **is_expired**: | ||
+ | * **is_saved**: | ||
+ | * **items**: list of product level data | ||
+ | * **amount**: Quoted amount (mg) | ||
+ | * **effective_price_display**: | ||
+ | * **price**: effective price | ||
+ | * **product_mcule_id**: | ||
+ | * **product**: | ||
+ | * **product_compound_mcule_id**: | ||
+ | * **product_delivery_time**: | ||
+ | * **product_price**: | ||
+ | * **product_purity**: | ||
+ | * **structure_origin_mcule_id**: | ||
+ | * **quote**: The ID of the quote this product level quote data belongs to. | ||
+ | * **missing_mcule_ids**: | ||
+ | * **name**: The name of the quote. Quotes created via the API don't have names. | ||
+ | * **order_data**: | ||
+ | * **payment_due_days**: | ||
+ | * **price**: Total price of quote (USD) | ||
+ | * **price_items**: | ||
+ | * **product_discount_price**: | ||
+ | * **products_price**: | ||
+ | * **query**: The quote query fields | ||
+ | * **reference_id_full**: | ||
+ | * **reformatting_price**: | ||
+ | * **shipping_price**: | ||
+ | * **site_url**: | ||
+ | * **special_formatting_price**: | ||
+ | * **state**: State code of the quote. | ||
+ | * **state_display**: | ||
+ | * **supplier_data**: | ||
+ | * **delivery_price**: | ||
+ | * **delivery_time**: | ||
+ | * **effective_price**: | ||
+ | * **avg_effective_price**: | ||
+ | * **products_count**: | ||
+ | * **products_price**: | ||
+ | * **quote**: The ID of the quote this supplier quote data belongs to. | ||
+ | * **reformatting_price**: | ||
+ | * **supplier**: | ||
+ | * **suppliers_count**: | ||
+ | * **total_cost**: | ||
+ | * **total_cost_without_discount**: | ||
+ | * **total_discount_price**: | ||
+ | * **type**: Type code of the quote. | ||
+ | * **type_display**: | ||
+ | * **updated**: | ||
+ | * **valid_until**: | ||
+ | | ||
+ | ==== Quote - Missing structures ==== | ||
+ | |||
+ | You can get the missing structures along with the reason of their exclusion. | ||
+ | |||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | ==== Download quote as PDF ==== | ||
+ | |||
+ | You can download a quote as a PDF file. Please note that the PDF file generation can take some time, the more item it contains the more time it will take to generate the file. | ||
+ | |||
+ | The HTTP response contains a // | ||
+ | |||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | ==== Download quote as Excel (.xlsx) file ==== | ||
+ | |||
+ | You can download a quote as an Excel file. Please note that the file generation can take some time, the more item it contains the more time it will take to generate the file. | ||
+ | |||
+ | The HTTP response contains a // | ||
+ | |||
+ | < | ||
+ | http https:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ====== Code examples (Python) ====== | ||
+ | |||
+ | We created a public Git repository that contains Python code examples on how to use the Mcule API. These examples supplement the above API documentation and might give you a better understanding on how you can utilize those API endpoints currently. | ||
+ | |||
+ | The repository is available here: | ||
+ | [[https:// | ||
+ | |||
+ | We'll probably extend this repository with new examples later. | ||
api.txt · Last modified: 2024/05/10 08:12 by bkovats