Create a stock reservation

How to create a stock reservation via API

To create a new stock reservation, send a POST request to the /api/stock_reservations endpoint, passing the resource arguments in the request body.

Request

POST https://yourdomain.commercelayer.io/api/stock_reservations

Arguments

Body ParameterTypeRequired

type

string

Required

attributes.quantity

integer

Required

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

relationships.stock_item

object

Required

Example

The following request creates a new stock reservation:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/stock_reservations' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "stock_reservations",
    "attributes": {
      "quantity": 4
    },
    "relationships": {
      "stock_item": {
        "data": {
          "type": "stock_items",
          "id": "ABCRtyUpBa"
        }
      }
    }
  }
}'

Last updated