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 revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
ultimate-api [2020/04/11 12:18] flackultimate-api [2020/07/20 13:41] flack
Line 6: Line 6:
 You can find in the examples below the full URLs you have to use. You can find in the examples below the full URLs you have to use.
  
-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. Only the most important request/response headers are shown in the examples below.
Line 28: Line 28:
   * 100 searches / day   * 100 searches / day
  
-For authenticated users:+For authenticated users (access token required, see below):
  
   * 100 searches / minute   * 100 searches / minute
Line 627: Line 627:
  
 You can notice that you get lower prices but those prices are only valid in the context where you order the compounds together. You can notice that you get lower prices but those prices are only valid in the context where you order the compounds together.
 +
 +
 +
 +===== Quote Request API =====
 +
 +== Endpoint: ==
 +<code>/iquote-queries/</code>
 +
 +== Example API request: ==
 +<code>
 +echo '{"customer_name": "John Doe", "delivery_country": "US", "compounds": ["RAQLVHPPDXCQDS-UHFFFAOYSA-N
 +QWPFQODIGUYSLE-UHFFFAOYSA-N"], "amount": 1}' | http https://ultimateapp.mcule.com/api/v1/iquote-queries/ "Authorization: Token <your_token>" --print HBhb
 +</code>
 +
 +Mandatory fields:
 +  * **compounds**: you can specify this field in multiple ways:
 +     * list of InChIKeys (which you get from search results for example). For example: <code>{"compounds": ["VKCCTPSYCYARFI-UHFFFAOYSA-N", "DVPXLZBGJCHMEO-UHFFFAOYSA-N"]}</code>
 +     * list of InChIKey, amount pairs. This is useful if you want to request quote for different amounts. For example: <code>{"compounds": [{"inchi_key": "VKCCTPSYCYARFI-UHFFFAOYSA-N", "amount": 1}, {"inchi_key": "DVPXLZBGJCHMEO-UHFFFAOYSA-N", "amount": 5}]}</code>
 +  * **customer_name**: The customer's first name. It does not need to be specified if the user's name is who is requesting the call is specified.
 +  * **customer_last_name**: The customer's last name. It does not need to be specified if the user's last name is specified on the Edit profile page on mcule.com.
 +  * **delivery_country**: ISO 3166-1 alpha-2 code of the delivery country.
 +
 +
 +Optional fields:
 +  * **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.
 +  * **amount**: Amount per molecule (mg). (default: 1)
 +  * **currency**: Valid values are "USD", "EUR", "GBP". The default is "USD".
 +
 +
 +
 +== 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_name": "John Doe", 
 +    "delivery_country": "US", 
 +    "compounds": [
 +        "RAQLVHPPDXCQDS-UHFFFAOYSA-N",
 +        "QWPFQODIGUYSLE-UHFFFAOYSA-N"
 +    ]
 +}
 +</code>
 +
 +== Example response: ===
 +<code>
 +HTTP/1.1 201 CREATED
 +Allow: GET, POST, HEAD, OPTIONS
 +Content-Type: application/json
 +
 +{
 +    "amount": 1, 
 +    "api_url": "https://mcule.com/api/v1/iquote-queries/1/", 
 +    "created": "2020-07-20T15:21:55.339011", 
 +    "customer_email": "foo@bar.com", 
 +    "customer_name": "John Doe", 
 +    "delivery_country": "US", 
 +    "end_date": null, 
 +    "id": 1, 
 +    "notes": "", 
 +    "purity": null, 
 +    "start_date": null, 
 +    "state": 10, 
 +    "state_display": "Pending", 
 +    "user": 1
 +}
 +</code>
 +
 +
ultimate-api.txt · Last modified: 2021/05/25 14:27 by flack