Update stock¶
POST
*base*/stock
This updates the physicalStock
quantities in Centra. This is the number of products in stock including those that are reserved for orders.
Warning
You cannot set the quantity below the number that is reserved for orders, the value specified in allocatedStock
from Get stock. In the case the stock update contains a lower amount than the allocated stock, Centra will set the quantity to allocatedStock
which the lowest possible value without affecting any reserved orders.
The request will not return any error message, but an email notification can be sent to a Centra-administrator from the plugin settings.
Parameters¶
array
required
|
Array of products to update stock on.
|
||||||||
boolean
optional
|
Response in xml format instead of json. |
Request example¶
The example above uses EAN, this is the same field as the Get stock product field ean
. The example below uses SKU by combining the Get stock fields sku
, variantSku
and sizeSku
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | POST <base>/stock HTTP/1.1
Content-type: application/json
{
"products": [
{
"product": "1234567890123",
"quantity": 54
},
{
"product": "9876543210123",
"quantity": 55
},
{
"product": "5432167890123",
"quantity": 1
}
]
}
|
Optionally you can also include a cost / pcs value for the items.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | POST <base>/stock HTTP/1.1
Content-type: application/json
{
"products":[
{
"product": "1234567890123",
"quantity": 54,
"costPrice": 12.54,
"costPriceCurrency": "SEK"
},
{
"product": "9876543210123",
"quantity": 55,
"costPrice": 8.12,
"costPriceCurrency": "EUR"
},
{
"product": "5432167890123",
"quantity": 1,
"costPrice": 54.24,
"costPriceCurrency": "USD"
}
]
}
|
Response¶
200
Content-type: application/json
string
required
|
ok if success, else no . |
||||
string
optional
|
If status returns no , this value should send back a message why it failed. |
||||
object
optional
|
If
|
Response example¶
1 2 3 | {
"status":"ok"
}
|
Error example¶
1 2 3 4 5 6 7 8 9 10 | {
"status": "no",
"msg": "Some of the products were not updated",
"errors": {
"productsNotFound": [
"9876543210123",
"5432167890123"
]
}
}
|