This method allows to reserve a given quantity of model. Especially you can increment, decrement a quantity of a reserved model, or add a new one. If a model is not in the reservation, the method will automatically add it.

Use

Method Url
POST /restful/ghost/orders/sold/

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

Request Body

The request body contains a list of the operations necessary to update the quantity of some products in the reservation. There are three kind of operation:

Lock and unlock change quantities relatively, set change quantities absolutely.

These three kinds of operations can be combined in any way: you can use just one of these or all of them.

Each operation contains a list of model affected by it. Each model has two attributes:

Example XML Body

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
    <operation type="lock">
        <model stock_id="3" quantity="3"/>
        <model stock_id="5" quantity="10"/>
    </operation>
    <operation type="unlock">
        <model stock_id="69" quantity="5"/>
        <model stock_id="79" quantity="8"/>
    </operation>
    <operation type="set">
        <model stock_id="55" quantity="10"/>
        <model stock_id="29" quantity="15"/>
    </operation>
</root>

Example JSON Body

{
  "operations": [
    {
      "type": "lock",
      "models": [
          {
          "stock_id": "1567",
          "quantity": "1"
        },
        {
          "stock_id": "1578",
          "quantity": "2"
        }
      ]
    },
    {
      "type": "unlock",
      "models": [
      ]
    },
    {
      "type": "set",
      "models": [

      ]
    }
  ]
}

Response Body

The response body contains a list of the model in the reservation. Each model has three attributes:

Example XML Response

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root order_id="1000">
    <model stock_id="3" locked="11" available="5" />
    <model stock_id="5" locked="33" available="2" />
    <model stock_id="29" locked="5" available="1" />
    <model stock_id="55" locked="2" available="11" />
    <model stock_id="120" locked="1" available="120" />
    <model stock_id="133" locked="9" available="0" />
</root>

Example JSON Response

{
    "models": [
        {
            "stock_id": "1578",
            "locked": "2",
            "available": "0"
        },
        {
            "stock_id": "1567",
            "locked": "1",
            "available": "0"
        }
    ],
    "order_id": "0"
}

Notes