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 revision Previous revision
Next revision
Previous revision
api [2019/09/08 16:54]
flack [Quote API]
api [2020/04/22 12:01] (current)
flack
Line 1: Line 1:
 API base url: https://​mcule.com/​api/​v1/​ API base url: https://​mcule.com/​api/​v1/​
  
-Examples are demonstrated with [[https://​github.com/​jkbrzt/​httpie|HTTPie]].+Examples are demonstrated with [[https://​httpie.org|HTTPie]]
 + 
 +Only the most important request/​response headers are shown in the examples below.
  
 ====== Response status codes ====== ====== Response status codes ======
Line 63: Line 65:
             ],              ], 
             "​last_updated":​ "​2017-09-18", ​             "​last_updated":​ "​2017-09-18", ​
-            "​name":​ "Mcule Purchasable (full)"​+            "​name":​ "Mcule Purchasable (full)"​
 +            "​public":​ true
         },          }, 
         {         {
Line 83: Line 86:
             ],              ], 
             "​last_updated":​ "​2017-09-18", ​             "​last_updated":​ "​2017-09-18", ​
-            "​name":​ "Mcule Purchasable (in stock)"​+            "​name":​ "Mcule Purchasable (in stock)"​
 +            "​public":​ true
         }         }
     ]     ]
 } }
 </​code>​ </​code>​
 +
 +If you call this API endpoint as an authenticated user (=you provide a [[api#​authentication|valid token]]) you might get additional private entries if you have permission to access them.
  
  
Line 229: Line 235:
  
 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 support@mcule.com and we can provide you with token.+If you would like to access our protected API endpoints, please drop us an email at support@mcule.com ​including a brief summary on why and how you would like to use the API. We'll review your request, and if accepted, ​we'​ll ​provide you with an access ​token which you can use to call the API as an authenticated user.
  
 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 642: Line 648:
   * **target_volume**:​ The target volume (in ml), in case of solution based amount.   * **target_volume**:​ The target volume (in ml), in case of solution based amount.
   * **target_cc**:​ Target concentration (mM), in case of solution based amount.   * **target_cc**:​ Target concentration (mM), in case of solution based amount.
 +  * **extra_amount**:​ In case of solution based amount calculation extra amount (in mg) can be specified here.
   * **customer_email**:​ The customer'​s email address. By default it will be filled with the email address associated with the user making the API request.   * **customer_email**:​ The customer'​s email address. By default it will be filled with the email address associated with the user making the API request.
   * **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.   * **item_filters**:​ Per query item filters. Currently it supports only supplier filtering. See example below.
  
Line 1104: Line 1112:
         }         }
     ],      ], 
-    "​missing_mcule_ids":​ [],  
     "​name":​ "", ​     "​name":​ "", ​
     "​order_data":​ null,      "​order_data":​ null, 
Line 1280: Line 1287:
     * **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 (%)
     * **structure_origin_mcule_id**:​ The mcule ID of the query molecule.     * **structure_origin_mcule_id**:​ The mcule ID of the query molecule.
     * **quote**: The ID of the quote this product level quote data belongs to.     * **quote**: The ID of the quote this product level quote data belongs to.
-  * **missing_mcule_ids**:​ list of missing mcule IDs from the query 
   * **name**: The name of the quote. Quotes created via the API don't have names.   * **name**: The name of the quote. Quotes created via the API don't have names.
   * **order_data**:​ Order data. (Should be neglected).   * **order_data**:​ Order data. (Should be neglected).
Line 1319: Line 1326:
   * **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/<​quote_id>/​missing/​ "​Authorization:​ Token <​your_token>"​
 +</​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  ==== ==== Download quote as PDF  ====
  
Line 1338: Line 1389:
 http https://​mcule.com/​api/​v1/​iquotes/​15677/​download-excel/​ "​Authorization:​ Token <​your_token>"​ --download http https://​mcule.com/​api/​v1/​iquotes/​15677/​download-excel/​ "​Authorization:​ Token <​your_token>"​ --download
 </​code>​ </​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.1567954454.txt.gz · Last modified: 2019/09/08 16:54 by flack