Returns the materials stocked at a storage location (including those with zero stock), sorted by name. Archived materials are included too.
v1/materials/get_list.php
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| storage_id | int | Yes | Storage location ID |
| limit | int | No | Page size, from 1 to 1000 |
| offset | int | No | How many records to skip |
Without limit the whole list is returned. See Common Rules for pagination.
Response
An array materials with the material's fields and its stock at storage location storage_id:
| Field | Type | Description |
|---|---|---|
| id | int | Material ID |
| name | string | Name |
| sku | string | SKU |
| unit | string | Unit of measure, a code from Units of Measure |
| price | float | Price per unit |
| notes | string | Notes |
| archived | int | 1 if the material is archived |
| stock | float | Stock at storage location storage_id |
| minimum | float | Minimum stock at storage location storage_id |
| planned | float | Stock change from operations in the Planned status. null if there are none |
| categories | array | The material's categories: objects with id and name |
| suppliers | array | The material's suppliers: objects with id and name |
The total field holds the total number of materials at the storage location.
Example request
{
"storage_id": 3998,
"limit": 100,
"offset": 0
}
Example response
{
"success": true,
"materials": [
{
"id": 2051,
"name": "Oak board",
"sku": "M010",
"price": 135000,
"notes": "",
"archived": 0,
"stock": 4.2,
"minimum": 1,
"planned": null,
"unit": "cu m",
"categories": [
{
"id": 12,
"name": "Wood"
}
],
"suppliers": [
{
"id": 45,
"name": "Woodtrade Ltd"
}
]
}
],
"total": 1
}
Errors
| Error | Reason |
|---|---|
| No storage_id in input | storage_id is missing |
| Storage ID not found | Storage location not found or deleted |
| Invalid limit value. Must be between 1 and 1000 | Invalid limit |
| Offset requires limit | offset passed without limit |