Returns material stock across all storage locations as a single list: one row per «material, storage location» pair where the material is stocked.
v1/materials/get_stocks.php
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| material_ids | array | No | Material IDs. Without them, all materials 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 material ID and storage location ID. Deleted materials and storage locations are not included.
Example request
{
"material_ids": [2051, 2052]
}
Example response
{
"success": true,
"stocks": [
{
"material_id": 2051,
"storage_id": 3998,
"stock": 4.2,
"minimum": 1,
"planned": null
},
{
"material_id": 2051,
"storage_id": 4002,
"stock": 0,
"minimum": 0,
"planned": 1.5
}
],
"total": 2
}
Errors
| Error | Reason |
|---|---|
| Material_ids is not an array | material_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 |