Create a stock reservation
Reserves stock of an item against a cart or order. Fails if the quantity exceeds on-hand stock minus existing reservations. Reservations expire after a configured time; passing a clientReservationId makes retries return the existing reservation instead of creating a duplicate.
How to use it
- Take the item code from List items and the cart or order id the stock is for.
- Send itemId, quantity, reservationType and referenceId, plus a clientReservationId so a retry returns the same reservation.
- The reservation is ACTIVE and reduces available stock until it expires; move it on with Hold a cart reservation for checkout or Confirm a stock reservation.
BearerAuthAuthorizationBearer <JWT>application/json- body
itemId*stringItem code to reserve, from List items. The item must exist.
quantity*numberQuantity to set aside; must be greater than zero and no more than stock on hand minus quantities already reserved.
reservationType*stringCART for an open cart (lasts the configured cart time, 20 minutes by default) or ORDER (lasts the checkout hold time, 10 minutes by default).
"CART""ORDER"referenceId*stringIdentifier of the cart or order the stock is being held for.
uuidcustomerId?|Optional customer the reservation is for.
clientReservationId?|Optional id generated by your system. Resending the same id for the same item and reference returns the existing reservation.
OK
*/*- response
status*stringOutcome of the call: SUCCESS when the request was handled, ERROR otherwise.
message*stringShort human-readable message describing the outcome, e.g. which record was fetched or saved.
data?The stock reservation.
curl -X POST 'https://beta.iotoms.com/api/v1/inventory/reservations' \ -H 'Content-Type: application/json' \ -d '{ "itemId": "string", "quantity": 0, "reservationType": "CART", "referenceId": "8502eb05-558d-4480-8511-c1011710b340"}'{ "status": "string", "message": "string", "data": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "itemId": "string", "itemName": "string", "quantity": 0, "reservationType": "CART", "referenceId": "8502eb05-558d-4480-8511-c1011710b340", "customerId": "string", "status": "ACTIVE", "expiresAt": "2019-08-24T14:15:22Z", "confirmedAt": "2019-08-24T14:15:22Z", "releasedAt": "2019-08-24T14:15:22Z", "releaseReason": "string", "createdAt": "2019-08-24T14:15:22Z" }}