Contents
On this page
Get Unit - Plugixa Inventory
GET /plugixa-inventory/v1/units/{id}
Read one unit.
The user needs the plugixa_inventory_view capability (administrators have every inventory capability). With Pro Roles and permissions enforcing, their role must also allow reading units. Needs Plugixa Inventory Pro with the Units of measurement app on in Plugixa Inventory -> App Manager; with it off, this route answers 404.
Request
GET https://your-site.example/wp-json/plugixa-inventory/v1/units/4
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The unit’s id |
Responses
200 OK. data is the unit.
{
"success": true,
"data": {
"id": 4,
"code": "box12",
"name": "Box of 12",
"base_unit_id": 1,
"operator": "*",
"operation_value": 12.0,
"status": "published",
"created_by": 1,
"modified_by": 1,
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 09:30:00",
"deleted_at": null,
"base_unit_code": "pcs"
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The unit’s id |
data.code |
string |
The short form |
data.name |
string |
The name |
data.base_unit_id |
integer|null |
The unit it converts to, or null |
data.base_unit_code |
string|null |
That unit’s code |
data.operator |
string |
*, /, +, -, or empty for a base unit |
data.operation_value |
number |
The conversion value |
data.status |
string |
published or unpublished |
Errors
| Status | Code | When |
|---|---|---|
404 |
plugixa_inventory_not_found |
No unit with that id, or it is in the trash. |
Plus the errors every endpoint can return.
Examples
curl -s "https://your-site.example/wp-json/plugixa-inventory/v1/units/4" \
-u "admin:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-inventory/v1/units/4');
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/units/4', {
headers: { 'Authorization': auth },
});
const { data } = await response.json();
Quick Links
Share