This method creates an order with the given items and quantities for a user’s customer. The order will be dispatched, after user's payment, to the given recipient (user’s customer).
Use
Method | Url |
---|---|
Post | /restful/ghost/orders/0/dropshipping |
Request Headers
This method works using JSON or XML format, set the following headers to choose the format you want to use:
Key | Value |
---|---|
Accept | application/xml or application/json |
Content-type | application/xml or application/json |
Authentication
Remember to authenticate properly, using HTTP Basic Authentication with your API-Key as username and your password.
Request Body
The request body contains the order items informations and the recipient detail.
- key : identifies the user’s platform order id, it's the same value used in orderStatusOrderId
- date : the date of the order in the format - “yyyy/MM/dd HH:mm:ss Z”, where:
- yyyy = four digits year (i.e. 2017)
- MM = two digits month from 01 to 12
- dd = two digits day in the month, from 01 to 31
- HH = two digits hour of the day for the 24-hour clock, from 00 to 23
- mm = two digits minutes in the hour, from 00 to 59
- ss = two digits seconds in the minute, from 00 to 59
- Z = RFC 822 (https://www.w3.org/Protocols/rfc822/#z28) style numeric time zone offset from GMT, e.g. 0800. This value will be adjusted as necessary for Daylight Saving Time
- recipient : order recipient
- careof : care of
- cfpiva : vat number or person ID of your customer (not required)
- customer_key : customer ID on your platform (not required)
- notes : notes (not required)
- street_type : shipping street type (ex. Via, Street, Avenue) (not required)
- street_name : shipping street name
- address_number : shipping house number
- zip : shipping zip code
- city : shipping city
- province : shipping province or district
- countrycode : shipping country code using the ISO 3166-1 alpha-2 standard
- prefix : prefix phone number of your customer
- number : phone number of your customer
- stock_id : model id of the size/color variation
- quantity : the required quantity to be shippend
- carrierId : carrier ID (not required, a default courier will be assigned). You can find all available carriers ids using Carriers API
- autoConfirm: if set to true or omitted, will cause the order to be confirmed if the conditions are met (see below); if set to false the order will not be confirmed, even if the conditions are met
Conditions for autoConfirm: - One of the following must be true: - The user's ecredit is sufficient to cover the cost of the order - The user has enabled auto-confirmation in their settings - The carrier is valid for the order, or a default carrier can be assigned to the order, if no ID is provided
Example XML Request
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<order_list>
<order>
<key>2345</key>
<date>2017/01/31 23:59:59 +0000</date>
<carrierId>20</carrierId>
<recipient_details>
<recipient>ACME srl</recipient>
<careof />
<cfpiva>12345558</cfpiva>
<customer_key>7777</customer_key>
<notes></notes>
<address>
<street_type>Via</street_type>
<street_name>Roma</street_name>
<address_number>1</address_number>
<zip>10100</zip>
<city>TORINO</city>
<province>TO</province>
<countrycode>IT</countrycode>
</address>
<phone>
<prefix>+39</prefix>
<number>0112838474</number>
</phone>
</recipient_details>
<item_list>
<item>
<stock_id>148148</stock_id>
<quantity>10</quantity>
</item>
<item>
<stock_id>148367</stock_id>
<quantity>15</quantity>
</item>
</item_list>
<autoConfirm>true</autoConfirm>
</order>
</order_list>
</root>
Example JSON Request
{
"order_list": [
{
"key": "2357",
"date": "2021/02/02 23:59:59 +0000",
"carrierId": "20",
"recipient_details": {
"recipient": "ACME srl",
"cfpiva": "12345558",
"customer_key": "7777",
"address": {
"street_type": "Via",
"street_name": "Roma",
"address_number": "1",
"zip": "10100",
"city": "TORINO",
"province": "TO",
"countrycode": "IT"
},
"phone": {
"prefix": "+39",
"number": "0112838474"
}
},
"item_list": [
{
"stock_id": "1578",
"quantity": "1"
}
],
"autoConfirm": "true"
}
]
}
Response Body
The response body contains a list of the models remaining in your reservation. Each model has three attributes:
- stock_id : the numerical id of the model
- locked : the amount of locked quantity
- available : the amount of model still available.
Example XML Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root order_id="1000">
<model stock_id="148148" locked="10" available="5" />
</root>
Example JSON Response
{
"models": [
{
"stock_id": 1578,
"locked": 1,
"available": 0
},
{
"stock_id": 1567,
"locked": 1,
"available": 0
}
],
"order_id": 0
}
Notes
-
Even if the order_list tag can accept multiple orders, it is strongly recommended, for better performance, to insert one order at a time.
-
The maximum addable quantity of a model depends on the available quantity. You can't exceed this quantity: if you require more than the available quantity, only the available quantity will be added and no error or message will be returned. In order to make sure that all your models are correctly added to your order make sure to have reserved them (using Reserve ) before calling this API.
-
If the request body contains not existing stock_ids, this will cause the abort of the order creation. Some of the required quantities may have been added to your reservation. We recommend you to always add all required quantities to your reservation before trying to use this API so you don't get any error caused by missing items.
-
If the request body contains errors this will cause the abort of the order creation. The http status code 429 will be returned and request body contains the error message.