User Tools

Site Tools


api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
api [2019/09/04 16:32] flackapi [2019/09/25 17:31] – [Quote - Missing structures] flack
Line 645: Line 645:
   * **delivery_time**: Delivery time limit (working days). Door-to-door delivery time. Only offer molecules that are available within the specified number of working days. You can specify null if delivery time is not critical. (default: 21)   * **delivery_time**: Delivery time limit (working days). Door-to-door delivery time. Only offer molecules that are available within the specified number of working days. You can specify null if delivery time is not critical. (default: 21)
   * **purity**: Required minimum purity (%). (default: null)   * **purity**: Required minimum purity (%). (default: null)
 +  * **higher_amounts**: Set to true if you would like to get a quote for the compounds in the largest possible quantity in case they do not cost more than the specified amount. (default: false)
 +  * **item_filters**: Per query item filters. Currently it supports only supplier filtering. See example below.
 +
 The **amount** or target concentration-volume pair (**target_volume** and **target_cc**) need to be specified. 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#compound_suppliers_public_api|Compound suppliers Public API endpoint]] or the data is provided to you in another form (e.g.: exported database file that contains the information). If you specify a non-existing supplier ID, you should get a validation error.
 +<code>
 +{
 +  "MCULE-2221628462": {"suppliers": [3]},
 +  "MCULE-6824753328": {"suppliers": [3, 48]}
 +}
 +</code> 
  
 Advanced optional fields: Advanced optional fields:
Line 1268: Line 1281:
     * **product**: The ID of the quoted product (should be neglected).     * **product**: The ID of the quoted product (should be neglected).
     * **product_compound_mcule_id**: The compound level structures' mcule ID of the quoted product.     * **product_compound_mcule_id**: The compound level structures' mcule ID of the quoted product.
 +    * **product_delivery_time**: Delivery time (working days)
     * **product_price**: Product price (USD)     * **product_price**: Product price (USD)
     * **product_purity**: Minimum purity (%)     * **product_purity**: Minimum purity (%)
Line 1306: Line 1320:
   * **updated**: The update datetime the quote.   * **updated**: The update datetime the quote.
   * **valid_until**: The datetime until the quote is valid.   * **valid_until**: The datetime until the quote is valid.
-   +   
 +==== Quote - Missing structures ==== 
 + 
 +You can get the missing structures along with the reason of their exclusion. 
 + 
 +<code> 
 +http https://mcule.com/api/v1/iquotes/15677/missing/ "Authorization: Token <your_token>" --print HBhb 
 +</code> 
 + 
 +And it will return a similar response to this: 
 +<code> 
 +
 +    "results":
 +        { 
 +            "data":
 +                "MCULE-6224850672": "No instant quotable products" 
 +            },  
 +            "id": 4,  
 +            "quote": 125,  
 +            "structure": 167312,  
 +            "structure_mcule_id": "MCULE-6224850672" 
 +        },  
 +        { 
 +            "data":
 +                "MCULE-7173925849": "No instant quotable products" 
 +            },  
 +            "id": 5,  
 +            "quote": 125,  
 +            "structure": 135326,  
 +            "structure_mcule_id": "MCULE-7173925849" 
 +        },  
 +        { 
 +            "data":
 +                "P-282184": "Purity filtering",  
 +                "P-307415": "Purity filtering" 
 +            },  
 +            "id": 6,  
 +            "quote": 125,  
 +            "structure": 201510,  
 +            "structure_mcule_id": "MCULE-9519333144" 
 +        } 
 +    ] 
 +
 +</code> 
 + 
 +==== 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 //Content-Disposition attachment; filename="<filename>"// header indicating that it should be downloaded. 
 + 
 +<code> 
 +http https://mcule.com/api/v1/iquotes/15677/download-pdf/ "Authorization: Token <your_token>" --download 
 +</code> 
 + 
 +==== 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 //Content-Disposition attachment; filename="<filename>"// header indicating that it should be downloaded. 
 + 
 +<code> 
 +http https://mcule.com/api/v1/iquotes/15677/download-excel/ "Authorization: Token <your_token>" --download 
 +</code> 
 + 
 + 
 + 
 +====== 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://bitbucket.org/mcule/mcule_api_usage_examples/]] 
 + 
 +We'll probably extend this repository with new examples later. 
api.txt · Last modified: 2024/05/10 08:12 by bkovats