User Tools

Site Tools


ultimate-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
Next revision Both sides next revision
ultimate-api [2020/07/20 15:47]
flack [Quote Request API]
ultimate-api [2020/12/01 19:15]
flack [Similarity search]
Line 225: Line 225:
 </code> </code>
  
-In case of similarity searches the **tan** value contains the similarity value.+In case of similarity searches the **tan** value the response contains the similarity value. 
 + 
 +In case of similarity searches you can control the minimum similarity with the **sim_threshold** param. Its default  value is 0.7. Its minimum value is also 0.7 unless you are allowed to use a lower value. For example: 
 +<code> 
 +
 +    "query":
 +        "type": "sim", 
 +        "query": "C(N1C(C(OC2CCCN(C3=CC=CC=C3)C2)=O)CN(C)C1=O)(=O)C(=C)CN1CCOCC1", 
 +        "limit": 5, 
 +        "sim_threshold": 0.8 
 +    } 
 +
 +</code>
  
  
Line 651: Line 663:
   * **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 (defined by the token).   * **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 (defined by the token).
   * **currency**: Valid values are "USD", "EUR", "GBP". The default is "USD".   * **currency**: Valid values are "USD", "EUR", "GBP". The default is "USD".
 +  * **scheme**: If you have access to predefined quote request schemes, you can specify here which one you want to use. 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. 
  
  
Line 680: Line 692:
  
 { {
-    "amount": 1,  +    "amount": 1, 
-    "api_url": "https://mcule.com/api/v1/iquote-queries/1/",  +    "api_url": "https://ultimateapp.mcule.com/api/v1/iquote-queries/9/", 
-    "created": "2020-07-20T15:21:55.339011",  +    "created_at": "2020-07-20T14:01:30.412763Z", 
-    "customer_email": "foo@bar.com",  +    "currency": "USD", 
-    "customer_name": "John Doe",  +    "customer_email": "foo@bar.com", 
-    "delivery_country": "US",  +    "customer_name": "John Doe", 
-    "end_date": null,  +    "delivery_country": { 
-    "id": 1,  +        "code": "US"
-    "notes": "",  +        "name": "United States of America" 
-    "purity": null,  +    }
-    "start_date": null,  +    "delivery_format": 0, 
-    "state": 10,  +    "delivery_format_display": "Dry powder/film in supplier vial", 
-    "state_display": "Pending",  +    "ended_at": null, 
-    "user": 1+    "extra_amount": null, 
 +    "id": 9
 +    "notes": "", 
 +    "purity": null, 
 +    "scheme": 1, 
 +    "started_at": null, 
 +    "state": 10, 
 +    "state_display": "Pending"
 +    "target_cc": null, 
 +    "target_volume": null
 +    "user": 2
 } }
 </code> </code>
 +
 +
 +====== Quote Request Status API ======
 +
 +Since processing a quote request and generating suitable quotes 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 url of 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 or it is also possible that we could not generate any quotes for a particular quote request. If there are quotes they will appear in the **quotes** field that 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 //9// we query the status of the quote request:
 +<code>
 +http https://ultimateapp.mcule.com/api/v1/iquote-queries/9/ "Authorization: Token <your_token>" --print HBhb
 +</code>
 +
 +== Example request: ===
 +
 +<code>
 +GET /api/v1/iquote-queries/9/ HTTP/1.1
 +Accept: */*
 +Accept-Encoding: gzip, deflate
 +Authorization: Token <your_token>
 +</code>
 +
 +== Example response: ===
 +<code>
 +HTTP/1.1 200 OK
 +Allow: GET, HEAD, OPTIONS
 +Connection: keep-alive
 +Content-Encoding: gzip
 +Content-Type: application/json
 +
 +{
 +    "amount": 1,
 +    "api_url": "https://ultimateapp.mcule.com/api/v1/iquote-queries/9/",
 +    "created_at": "2020-07-20T14:01:30.412763Z",
 +    "currency": "USD",
 +    "customer_email": "foo@bar.com",
 +    "customer_name": "John Doe",
 +    "delivery_country": {
 +        "code": "US",
 +        "name": "United States of America"
 +    },
 +    "delivery_format": 0,
 +    "delivery_format_display": "Dry powder/film in supplier vial",
 +    "ended_at": "2020-07-20T14:01:30.514096Z",
 +    "extra_amount": null,
 +    "id": 9,
 +    "notes": "",
 +    "purity": null,
 +    "quotes": [
 +        {
 +            "additional_document_notes": "",
 +            "api_url": "https://ultimateapp.mcule.com/api/v1/iquotes/9/",
 +            "avg_product_price": "667.74",
 +            "avg_product_price_currency": "USD",
 +            "coverage_percent": 100,
 +            "created_at": "2020-07-20T14:01:30.506962Z",
 +            "id": 9,
 +            "modified_at": "2020-07-20T14:01:30.506997Z",
 +            "product_discount_price": null,
 +            "product_discount_price_currency": "USD",
 +            "products_price": 1335.48,
 +            "products_price_currency": "USD",
 +            "query": 9,
 +            "reference_id_full": "UI-9",
 +            "reformatting_price": null,
 +            "reformatting_price_currency": "USD",
 +            "selection_criteria": 10,
 +            "selection_criteria_display": "Best price",
 +            "shipping_price": 51.09,
 +            "shipping_price_currency": "USD",
 +            "state": 10,
 +            "state_display": "Displayed",
 +            "total_discount_price": null,
 +            "total_discount_price_currency": "USD",
 +            "total_price": 1386.57,
 +            "total_price_currency": "USD",
 +            "valid_until": "2020-08-19T14:01:30.506962Z"
 +        }
 +    ],
 +    "scheme": 1,
 +    "started_at": "2020-07-20T14:01:30.464496Z",
 +    "state": 30,
 +    "state_display": "Done",
 +    "target_cc": null,
 +    "target_volume": null,
 +    "user": 2
 +}</code>
 +
 +Check for the **quotes** field. If it is there and contains some items in the list, we could generate some quotes for your quote query. As you can see from the above result, we could generate 1 quote for the quote query. A "Best price" quote.
 +
 +
 +====== Quote API  ======
 +
 +In order to get the detailed data of an individual quote, you can call the detail API endpoint of a quote, for example for the quote with ID //9//:
 +
 +<code>
 +http https://ultimateapp.mcule.com/api/v1/iquotes/9/ "Authorization: Token <your_token>" --print HBhb
 +</code>
 +
 +== Example request: ===
 +<code>
 +GET /api/v1/iquotes/9/ HTTP/1.1
 +Accept: */*
 +Accept-Encoding: gzip, deflate
 +Authorization: Token <your_token>
 +</code>
 +
 +== Example response: ===
 +<code>
 +HTTP/1.1 200 OK
 +Allow: GET, HEAD, OPTIONS
 +Content-Encoding: gzip
 +Content-Type: application/json
 +
 +{
 +    "additional_document_notes": "",
 +    "api_url": "https://ultimateapp.mcule.com/api/v1/iquotes/9/",
 +    "avg_product_price": "667.74",
 +    "avg_product_price_currency": "USD",
 +    "coverage_percent": 100,
 +    "created_at": "2020-07-20T14:01:30.506962Z",
 +    "id": 9,
 +    "items": [
 +        {
 +            "amount": 1,
 +            "compound": {
 +                "archived_at": null,
 +                "inchi_key": "RAQLVHPPDXCQDS-UHFFFAOYSA-N",
 +                "smiles": "C(NC1=C(C#N)C=C(C#N)C=N1)(=O)C1N=C(N2CCN(C3=CC=CC=C3)CC2)SC=1"
 +            },
 +            "product_price": 637.27,
 +            "product_price_currency": "USD",
 +            "purity_percent": 90
 +        },
 +        {
 +            "amount": 1,
 +            "compound": {
 +                "archived_at": null,
 +                "inchi_key": "QWPFQODIGUYSLE-UHFFFAOYSA-N",
 +                "smiles": "C(N(C(CSCC1OC=CC=1)=O)C1=C(C(F)(F)F)C=CC=C1)(=O)CCC1=NOC=C1"
 +            },
 +            "product_price": 698.21,
 +            "product_price_currency": "USD",
 +            "purity_percent": 90
 +        }
 +    ],
 +    "payment_due_days": 30,
 +    "price_items": [
 +        {
 +            "attr": "products_price",
 +            "name": "Products price",
 +            "price": 1335.48,
 +            "price_currency": "USD"
 +        },
 +        {
 +            "attr": "product_discount",
 +            "name": "Product discount (0%)",
 +            "price": 0.0,
 +            "price_currency": "USD"
 +        },
 +        {
 +            "attr": "shipping_price",
 +            "name": "Shipping & package consolidation",
 +            "price": 51.09,
 +            "price_currency": "USD"
 +        },
 +        {
 +            "attr": "reformatting_price",
 +            "name": "Reformatting",
 +            "price": 0.0,
 +            "price_currency": "USD"
 +        },
 +        {
 +            "attr": "total_discount_price",
 +            "name": "Total discount (0%)",
 +            "price": 0.0,
 +            "price_currency": "USD"
 +        }
 +    ],
 +    "product_discount_price": null,
 +    "product_discount_price_currency": "USD",
 +    "products_price": 1335.48,
 +    "products_price_currency": "USD",
 +    "query": {
 +        "amount": 1,
 +        "api_url": "https://ultimateapp.mcule.com/api/v1/iquote-queries/9/",
 +        "created_at": "2020-07-20T14:01:30.412763Z",
 +        "currency": "USD",
 +        "customer_email": "foo@bar.com",
 +        "customer_name": "John Doe",
 +        "delivery_country": {
 +            "code": "US",
 +            "name": "United States of America"
 +        },
 +        "delivery_format": 0,
 +        "delivery_format_display": "Dry powder/film in supplier vial",
 +        "ended_at": "2020-07-20T14:01:30.514096Z",
 +        "extra_amount": null,
 +        "id": 9,
 +        "notes": "",
 +        "purity": null,
 +        "scheme": 1,
 +        "started_at": "2020-07-20T14:01:30.464496Z",
 +        "state": 30,
 +        "state_display": "Done",
 +        "target_cc": null,
 +        "target_volume": null,
 +        "user": 2
 +    },
 +    "reference_id_full": "UI-9",
 +    "reformatting_price": null,
 +    "reformatting_price_currency": "USD",
 +    "selection_criteria": 10,
 +    "selection_criteria_display": "Best price",
 +    "shipping_price": 51.09,
 +    "shipping_price_currency": "USD",
 +    "state": 10,
 +    "state_display": "Displayed",
 +    "total_discount_price": null,
 +    "total_discount_price_currency": "USD",
 +    "total_price": 1386.57,
 +    "total_price_currency": "USD",
 +    "valid_until": "2020-08-19T14:01:30.506962Z"
 +}
 +</code>
 +
 +== Fields: ===
 +  * **additional_document_notes**: Additional document notes
 +  * **avg_product_price**: Average product price
 +  * **avg_product_price_currency**: Currency of average product price
 +  * **coverage_percent**: How many of the query molecules appear in the quote. E.g. if your query contains 10 molecules and you get a quote for 9, it is 90%.
 +  * **created_at**: The creation datetime of the quote.
 +  * **id**: The ID of the Instant Quote.
 +  * **items**: list of product level data
 +    * **amount**: Quoted amount (mg)
 +    * **compound**: the quoted compound
 +    * **product_price**: product price
 +    * **product_price_currency**: currency of product price
 +    * **purity_percent**: Guaranteed purity (%)
 +  * **payment_due_days**: Payment terms. Number of days net or prepayment by credit card
 +  * **price_items**: The list of price items. They are only used for display purposes basically.
 +  * **product_discount_price**: Discount of products price
 +  * **product_discount_price_currency**: Currency of discount of products price
 +  * **products_price**: Price of products
 +  * **products_price_currency**: Currency of price of products
 +  * **query**: The quote query fields
 +  * **reference_id_full**: The full reference ID of the instant quote.
 +  * **reformatting_price**: Reformatting price (USD)
 +  * **reformatting_price_currency**: Currency of reformatting price
 +  * **selection_criteria**: Selection criteria code of the quote.
 +  * **selection_criteria_display**: Human readable selection criteria of the quote.
 +  * **shipping_price**: Shipping & handling cost
 +  * **shipping_price_currency**: Currency of Shipping & handling cost
 +  * **state**: State code of the quote.
 +  * **state_display**: Human readable state of the quote.
 +  * **total_discount_price**: Total discount price
 +  * **total_discount_price_currency**: Currency of total discount price
 +  * **total_price**: Total price of quote
 +  * **total_price_currency**: Currency of the total price
 +  * **valid_until**: The datetime until the quote is valid.
 +  
 +==== 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://ultimateapp.mcule.com/api/v1/iquotes/9/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://ultimateapp.mcule.com/api/v1/iquotes/9/download-excel/ "Authorization: Token <your_token>" --download
 +</code>
 +
 +
  
  
ultimate-api.txt · Last modified: 2021/05/25 16:27 by flack