Create Stock for Product
POST/inventories/:product_uuid
Sets the inventory quantity for the specified product. When you take this action, you are choosing to manage the inventory for this product in Commerce.
Request
Path Parameters
The unique identifier of the product.
- application/json
Body
data InventoryCreaterequired
The amount of inventory available.
Responses
- 201
- 400
- 500
Success. Stock was successfully created for product
- application/json
- Schema
- Example (from schema)
Schema
data Inventory
The unique identifier of the product.
Possible values: [stock
]
Default value: stock
The type represents the object being returned. Always stock
.
The total amount of stock we have.
The amount of stock available for purchase.
The amount of paid for stock, also known as reserved.
{
"data": {
"id": "f976dace-450f-4a5d-8877-d119c5a550a1",
"type": "stock",
"total": 100,
"available": 75,
"allocated": 25
}
}
Bad request. The request failed validation.
- application/json
- Schema
- Example (from schema)
- missing-name
Schema
- Array [
- ]
errors ErrorBody[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred."
}
]
}
{
"errors": [
{
"title": "Validation Error",
"status": 400,
"detail": "Your request was invalid"
}
]
}
Internal server error. There was a system failure in the platform.
- application/json
- Schema
- Example (from schema)
- internal-server-error
Schema
- Array [
- ]
errors ErrorBody[]required
The HTTP response code of the error.
A brief summary of the error.
Optional additional detail about the error.
{
"errors": [
{
"status": 500,
"title": "Internal server error",
"detail": "An internal error has occurred."
}
]
}
{
"errors": [
{
"title": "Internal Server Error",
"status": 500
}
]
}