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
api [2023/06/03 07:19] – [Quote Request API] flackapi [2024/05/10 08:12] (current) – [Quote Request API] adapt to item_level_iq_info bkovats
Line 1072: Line 1072:
  
 Optional fields: Optional fields:
-  * **amount**: Preferred amount per molecule (mg). (default: 1) +  * Weight (mg) based amount fields   
-  * **min_amount**: Acceptable minimum amount (mg). (default: null+    * **amount**: Preferred amount per molecule (mg). 
-  * **target_volume**: The target volume (in µL), in case of solution based amount+    * **min_amount**: Acceptable minimum amount (mg). (default: 1) 
-  * **target_cc**: Target concentration (mM), in case of solution based amount+  * Amount (µmol) based amount fields 
-  * **extra_amount**: In case of solution based amount calculation the preferred extra amount (in mg) can be specified here. +    * **target_amount_umol**: Preferred amount per molecule (µmol). 
-  * **min_extra_amount**: In case of solution based amount calculation the acceptable minimum extra amount (in mg) can be specified here.+    * **min_amount_umol**: Acceptable minimum amount (µmol). (default: 1
 +  * Solution based amount fields 
 +    * **target_volume**: The target volume (in µL). 
 +    * **target_cc**: Target concentration (mM). 
 +    * **extra_amount**: In case of solution based amount calculation the preferred extra amount (in mg) can be specified here. 
 +    * **min_extra_amount**: In case of solution based amount calculation the acceptable minimum 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)   * **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 supplier and product filtering. See example below.
   * **scheme**: If you have access to predefined / pre-negotiated quote request schemes, you can specify here which one you want to use. You have to send the ID of the scheme which will be provided to you after negotiation. A quote query scheme is essentially a template that contains predefined quote query parameters, or even include private parameters that affect quote generation in various ways (e.g.: discounts, predefined custom prices). These parameters can be customized for your use case. The scheme might already contain mandatory fields like delivery_country. In this case you don't have to specify them again, they will be applied from the scheme. Any explicitly specified public parameter during the request will override the one that comes from the specified scheme.    * **scheme**: If you have access to predefined / pre-negotiated quote request schemes, you can specify here which one you want to use. You have to send the ID of the scheme which will be provided to you after negotiation. A quote query scheme is essentially a template that contains predefined quote query parameters, or even include private parameters that affect quote generation in various ways (e.g.: discounts, predefined custom prices). These parameters can be customized for your use case. The scheme might already contain mandatory fields like delivery_country. In this case you don't have to specify them again, they will be applied from the scheme. Any explicitly specified public parameter during the request will override the one that comes from the specified scheme. 
  
-The **amount** or target concentration-volume pair (**target_volume** and **target_cc**) need to be specified.+The **amount** or **target_amount_umol** or target concentration-volume pair (**target_volume** and **target_cc**) needs to be specified. In case more than one of these is provided, you should get a validation error. Any other values that don't belong to the same type of amount are ignored during the quote generation. For example if **amount** and **min_amount_umol** are provided, the latter is ignored.
  
 **item_filters** example: **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). 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.+Currently supplier and product filtering is supported. You can specify a supplier and/or product ID list in the **suppliers** and **products** fields to restrict product selection of a given item to a list of suppliers and/or products. If both filters are specified, both of them are applied. If the **suppliers** 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). Product IDs are accepted in both the string (e.g. "P-430012732") and number (e.g. 430012732) format. If you specify a non-existing supplier or product ID, you should get a validation error.
 <code> <code>
 { {
-  "MCULE-2221628462": {"suppliers": [3]}, +  "MCULE-2221628462": { 
-  "MCULE-6824753328": {"suppliers": [3, 48]}+    "suppliers": [3] 
 +  }, 
 +  "MCULE-6824753328": { 
 +    "suppliers": [3, 48]
 +    "products: ["P-430012732", "P-600234524"
 +  }
 } }
 </code>  </code> 
Line 1171: Line 1182:
 </code> </code>
  
 +Alternative use of the endpoint:
  
 +Instead of **mcule_ids** you can specify a list of items in the **items** field. Each item has to be a data structure where the **mcule_id** field is mandatory and the following fields can be specified optionally:
 +  * amount fields: you can set the amount on an item-level by providing the appropriate amount fields (see above)
 +  * **suppliers**: list of supplier IDs for supplier filtering (same as **suppliers** in **item_filters** above)
 +  * **products**: list of product IDs for product filtering (same as **products** in **item_filters** above)
 +  * **user_ref_id**: any custom identifier (text) that will be included in the quote
 +
 +If the amount is provided for an item, it overwrites the globally set amount for that particular item. Note that the global amount must be provided even if it's specified individually for every item.
 +
 +== Example request: ===
 +<code>
 +POST /api/v1/iquote-queries/ HTTP/1.1
 +Accept: application/json, */*
 +Accept-Encoding: gzip, deflate
 +Authorization: Token <your_token>
 +Content-Type: application/json
 +
 +{
 +    "amount": 1,
 +    "customer_first_name": "John", 
 +    "customer_last_name": "Doe", 
 +    "delivery_country": "US", 
 +    "items": [
 +        {
 +            "mcule_id": "MCULE-6813962937",
 +            "user_ref_id": "molecule1",
 +            "target_amount_umol": 10,
 +            "products": ["P-871069132", "P-855381908"],
 +            "suppliers": [15, 64, 93]
 +        },
 +        {
 +            "mcule_id": "MCULE-5422721033"
 +        }
 +    ]
 +}
 +</code>
 +
 +== Example response: ===
 +<code>
 +HTTP/1.1 201 CREATED
 +Allow: GET, POST, HEAD, OPTIONS
 +Content-Type: application/json
 +
 +{
 +    "id": 62536,
 +    "state_display": "Pending",
 +    "api_url": "https://mcule.com/api/v1/iquote-queries/62536/",
 +    "site_url": "https://mcule.com/quote/query/62536/",
 +    "item_filters": {
 +        "MCULE-6813962937": {
 +            "suppliers": [
 +                15,
 +                64,
 +                93
 +            ],
 +            "products": [
 +                871069132,
 +                855381908
 +            ]
 +        }
 +    },
 +    "delivery_format_display": "Dry powder/film in supplier vial",
 +    "thoroughness_display": "Mildly thorough",
 +    "amount": 1,
 +    "min_amount": 1,
 +    "target_volume": null,
 +    "target_cc": null,
 +    "target_amount_umol": null,
 +    "min_amount_umol": 1,
 +    "extra_amount": null,
 +    "min_extra_amount": null,
 +    "customer_email": "",
 +    "purity": null,
 +    "delivery_time": null,
 +    "higher_amounts": false,
 +    "keep_original_salt_form": false,
 +    "keep_original_tautomer_form": false,
 +    "keep_original_stereo_form": false,
 +    "deliver_multiple_salt_forms": false,
 +    "additional_document_notes": "",
 +    "notes": "",
 +    "thoroughness": 10,
 +    "max_reliability_class": null,
 +    "customer_first_name": "John",
 +    "customer_last_name": "Doe",
 +    "delivery_country": "US",
 +    "delivery_contact_person_name": "",
 +    "delivery_contact_person_email": "",
 +    "delivery_contact_person_phone": "",
 +    "delivery_post_code": "",
 +    "delivery_city": "",
 +    "delivery_address": "",
 +    "created": "2024-05-10T09:56:57.008555",
 +    "promo_code": "",
 +    "exclude_products": "",
 +    "include_products": "",
 +    "state": 10,
 +    "start_date": null,
 +    "end_date": null,
 +    "user": 38573,
 +    "scheme": null
 +}
 +</code>
 ===== Quote Request Status API ===== ===== Quote Request Status API =====
  
api.txt · Last modified: 2024/05/10 08:12 by bkovats