This method allows to book and close an order with the desired products.
It creates a new order in Booked status, acking you the numerical id of the order created. The products, if previously added to the reservation, will be automatically removed from reservation (created with Reserve) and added to this one.
Use
Method | Url |
---|---|
POST | /restful/ghost/supplierorder/acquire/ |
Authentication
Remember to authenticate properly, using HTTP Basic Authentication with your API-Key as username and your password.
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 | text/plain |
Content-type | application/xml or application/json |
Request Body
The request body contains a list of desired products that will join the created order. Each product has two attributes:
- stock_id : the numerical id of the model of the product
- quantity : the quantity desired in the order
The quantity can be less, equal or greater than the quantities in the reservation:
- less : the remaining quantities are kept in the reservation.
- equal : the stock has removed from the reservation.
- greater : if there are available stocks they are added to the order, otherwise a “not found” error has returned.
The optional tag carrierId assigns the carrier of the given ID to the order. You can find all available carriers ids using Carriers API If omitted, a default carrier will be assigned.
The optional tag autoConfirm takes a boolean value and operates as follows:
- true : The order will be automatically confirmed, assuming the following are true:
- 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
- One of the following must be true:
- false : The order will not be confirmed even if the previous conditions are met
If the tag is omitted, the order will behave as if autoConfirm was set to true.
Example XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<supplierorder>
<products>
<product stock_id="59" quantity="10"/>
<product stock_id="10" quantity="7"/>
<product stock_id="29" quantity="13"/>
</products>
<carrierId>20</carrierId>
<autoConfirm>true</autoConfirm>
</supplierorder>
Example JSON
{
"products": [
{
"stock_id": "3601",
"quantity": "2"
}
],
"carrierId": 39,
"autoConfirm": false
}
Response Body
The response body contains a number which represents the order_id of the created order.
Notes
-
The maximum addable quantity of a model is dependent 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_id, this will cause the abort of the order creation. Some of the required quantites 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
-
The platform does not check the stock_id of the products belongs to the content of the order.
-
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.