Stock
Frequency:
Full stock is sent once a day, at an agreed time, for each store. Partial updates can be sent in between when stock of individual articles changes.
Expected data:
Stock quantities of articles in a specific store on a specific date.
- Purchase active articles: include only articles that are active for purchasing.
- Store active assortment: include only articles that are part of the store's active assortment.
- Negative, zero or unavailable stock: report the quantity as
0.
Technical:
- Articles unknown to DSOrder are skipped without an error.
- Records with a quantity of
99999or more are skipped without an error. - A missing or
nullquantity is saved as0. - Quantities are stored with three decimal places.
- Each successful import triggers recalculation in DSOrder for that store and date.
Import Full Stock
Method: POST
URL: https://{url}/stock/{date}/{store_id}
Replaces the stock of the store for the date. All stock previously sent for this store and date is deleted and replaced with the request content; articles not in the request have no stock for that date afterwards. Sending an empty array clears the stock for that date.
Resending the same request is safe.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| date | date | Yes | Stock date in yyyy-mm-dd format |
| store_id | string | Yes | Unique store identifier in the external system |
Request Body
The request body is a JSON array of objects.
| Name | Type | Required | Description |
|---|---|---|---|
| article_id | string | Yes | Unique article identifier in the external system |
| quantity | number | Yes | Stock quantity in base units |
Request Example
[
{
"article_id": "ART-00001",
"quantity": 123
},
{
"article_id": "ART-00002",
"quantity": 12.250
}
]
Response
200: OK — Success
{
"success": true,
"message": null,
"data": null,
"warnings": []
}
200: OK — Error
Unknown store:
{
"success": false,
"message": "Store with external ID 'STORE-9999' was not found for organization '42'",
"data": null,
"warnings": []
}
Request body is not a valid array of stock records, or contains undocumented fields:
{
"success": false,
"message": "Failed to map JSON",
"data": null,
"warnings": []
}
Other possible messages are "Failed to process JSON" (body is not valid JSON) and
"Failed to process request" (unexpected error, for example a date that is not in yyyy-mm-dd
format).
Import Partial Stock
Method: PATCH
URL: https://{url}/stock/{date}/{store_id}
Updates the stock of the listed articles for the store and date. Existing stock of a listed article is overwritten, missing stock is created, and stock of articles that are not in the request is left unchanged.
Resending the same request is safe.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| date | date | Yes | Stock date in yyyy-mm-dd format |
| store_id | string | Yes | Unique store identifier in the external system |
Request Body
The request body is a JSON array of objects.
| Name | Type | Required | Description |
|---|---|---|---|
| article_id | string | Yes | Unique article identifier in the external system |
| quantity | number | Yes | Stock quantity in base units |
Request Example
[
{
"article_id": "ART-00001",
"quantity": 118
}
]
Response
200: OK — Success
{
"success": true,
"message": null,
"data": null,
"warnings": []
}
200: OK — Error
The error responses are the same as for Import Full Stock.
{
"success": false,
"message": "Store with external ID 'STORE-9999' was not found for organization '42'",
"data": null,
"warnings": []
}