Bulk create or update product stock
Creates or updates many product-stock records in a single request. The body is a JSON array of stock objects; for each element, the record of the given product is updated if it exists and created otherwise.
Every element must carry a product. An element that is missing product or is otherwise malformed is rejected with 406 Not Acceptable, and no changes from that request are applied.
On success the response is an empty object.
Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.
A JSON array of stock objects for the bulk upsert endpoint. For each element, the record of the given product is updated if it exists and created otherwise. Every element must carry a product.
The identifier of the product this stock belongs to. Required on create. On update it must match the record's current product — a different value is rejected.
The sellable quantity. A non-negative integer. Reconciled against sold_quantity_unreported on write.
0The unit of measure of a stock quantity.
Free-form JSON for extra data. Optional.
The quantity sold locally but not yet reported. Optional; normally managed internally.
The records were created or updated successfully. The response body is an empty object.
The request contains invalid or missing data — for example a missing product, a product that does not exist or already has a stock record, a negative stock, or an unrecognised unit_type. The response names the field the complaint belongs to.
Authentication credentials were not provided or are invalid.
The authenticated user does not have administrator privileges.
The request is well-formed but violates a business rule of the stock service — the product of an existing record was changed, or an element of a bulk upsert was missing product or was otherwise malformed.
POST /api/v1/remote/1/product_stock/bulk_upsert/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 74
[
{
"product": 3391,
"stock": 24
},
{
"product": 3392,
"stock": 0,
"unit_type": "qty"
}
]{}Last updated
Was this helpful?

