Returns product stock across all storage locations as a single list: one row per «product, storage location» pair where the product is stocked.
v1/products/get_stocks.php
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| product_ids | array | No | Product IDs. Without them, all products are returned |
| storage_ids | array | No | Only these storage locations. Without them, all storage locations |
| limit | int | No | Page size, from 1 to 1000 |
| offset | int | No | How many records to skip |
Rows are sorted by product ID and storage location ID. Deleted products and storage locations are not included. The total field holds the total number of rows matching the filters.
Example request
{
"product_ids": [3120, 312]
}
Example response
{
"success": true,
"stocks": [
{
"product_id": 312,
"storage_id": 3999,
"stock": 86,
"minimum": 40,
"planned": -40
},
{
"product_id": 3120,
"storage_id": 3999,
"stock": 12,
"minimum": 3,
"planned": null
},
{
"product_id": 3120,
"storage_id": 4005,
"stock": 0,
"minimum": 0,
"planned": 10
}
],
"total": 3
}
Errors
| Error | Reason |
|---|---|
| Product_ids is not an array | product_ids was not passed as an array |
| Storage_ids is not an array | storage_ids was not passed as an array |
| Storage ID not found | Storage location not found or deleted |
| Invalid limit value. Must be between 1 and 1000 | Invalid limit |