Contents
On this page
Stock Levels - Plugixa Inventory
GET /plugixa-inventory/v1/stock/levels/{item}
Read how much of one item each warehouse holds, and the total.
The user needs the plugixa_inventory_view capability. With Pro Roles and permissions enforcing, their role must allow reading both items and the stock ledger.
Note. An item id that does not exist is not an error: the answer is
200with atotalof0and no levels.
Request
GET https://your-site.example/wp-json/plugixa-inventory/v1/stock/levels/42
Path parameters
| Name | Type | Description |
|---|---|---|
item |
integer |
The item’s id |
Responses
200 OK. data is the item’s stock by warehouse.
{
"success": true,
"data": {
"item_id": 42,
"total": 120.0,
"levels": [
{
"warehouse_id": 1,
"warehouse_name": "Main warehouse",
"quantity": 80.0
},
{
"warehouse_id": 2,
"warehouse_name": "Shop floor",
"quantity": 40.0
}
]
}
}
| Field | Type | Meaning |
|---|---|---|
data.item_id |
integer |
The item asked for |
data.total |
number |
Sum over every warehouse |
data.levels[].warehouse_id |
integer |
The warehouse |
data.levels[].warehouse_name |
string|null |
The warehouse’s name |
data.levels[].quantity |
number |
On hand there. A warehouse the item has left can show 0.0 |
Errors
Plus the errors every endpoint can return.
Examples
curl -s "https://your-site.example/wp-json/plugixa-inventory/v1/stock/levels/42" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-inventory/v1/stock/levels/42');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERPWD => 'admin:' . getenv('WP_APP_PASSWORD'),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const auth = 'Basic ' + btoa(`admin:${process.env.WP_APP_PASSWORD}`);
const response = await fetch('https://your-site.example/wp-json/plugixa-inventory/v1/stock/levels/42', {
headers: { 'Authorization': auth },
});
const { data } = await response.json();
Quick Links
Share