Inventory Device
Manage inventory devices including status monitoring, organization filtering, and CRUD operations for network device management.
Base URL: https://control.zequenze.com/api/v1
Authentication: All endpoints require a Bearer token:
Authorization: Bearer <your-api-token>
Endpoints
GET /inventory_device/
Retrieve a list of inventory devices with optional filtering and pagination.
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| type | integer | query | No | Filter device by device 'type' ID field |
| status | string | query | No | Filter by status ('0'/'false'/'False' for Down, '1'/'true'/'True' for Up) |
| last_status_change_from | string | query | No | Filter by datetime in ISO format (2000-01-01, 2000-01-01 00:01:00, 2000-01-01 00:01:00+00:00) |
| organization | integer | query | No | Filter device by device 'organization' ID field |
| limit | integer | query | No | Number of results to return per page |
| offset | integer | query | No | The initial index from which to return the results |
| pending | boolean | query | No | Report if the device has pending settings |
| update_status | boolean | query | No | Use configured helpers to update device status before returning |
Example Request:
GET /api/v1/inventory_device/?organization=1&status=true&limit=10
Example Response:
{
"count": 25,
"next": "https://control.zequenze.com/api/v1/inventory_device/?limit=10&offset=10",
"previous": null,
"results": [
{
"id": 1,
"name": "Router-Main-01",
"type": 2,
"organization": 1,
"status": true,
"ip_address": "192.168.1.1",
"last_status_change": "2024-01-15T10:30:00Z",
"pending_settings": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
]
}
| Status | Description |
|---|---|
| 200 | Success |
| 401 | Unauthorized |
POST /inventory_device/
Create a new inventory device.
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| data | object | body | Yes | Device data object |
Example Request:
POST /api/v1/inventory_device/
Content-Type: application/json
{
"name": "Switch-Floor-02",
"type": 3,
"organization": 1,
"ip_address": "192.168.1.10",
"status": true
}
Example Response:
{
"id": 2,
"name": "Switch-Floor-02",
"type": 3,
"organization": 1,
"ip_address": "192.168.1.10",
"status": true,
"last_status_change": "2024-01-15T14:20:00Z",
"pending_settings": false,
"created_at": "2024-01-15T14:20:00Z",
"updated_at": "2024-01-15T14:20:00Z"
}
| Status | Description |
|---|---|
| 201 | Created successfully |
| 400 | Bad request - validation errors |
| 401 | Unauthorized |
GET /inventory_device/{id}/
Retrieve a specific inventory device by ID.
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes | Device ID |
| pending | boolean | query | No | Report if the device has pending settings |
| update_status | boolean | query | No | Use configured helpers to update device status before returning |
Example Request:
GET /api/v1/inventory_device/1/?update_status=true
Example Response:
{
"id": 1,
"name": "Router-Main-01",
"type": 2,
"organization": 1,
"status": true,
"ip_address": "192.168.1.1",
"last_status_change": "2024-01-15T10:30:00Z",
"pending_settings": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
| Status | Description |
|---|---|
| 200 | Success |
| 401 | Unauthorized |
| 404 | Device not found |
PUT /inventory_device/{id}/
Update an entire inventory device record.
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes | Device ID |
| data | object | body | Yes | Complete device data object |
Example Request:
PUT /api/v1/inventory_device/1/
Content-Type: application/json
{
"name": "Router-Main-01-Updated",
"type": 2,
"organization": 1,
"ip_address": "192.168.1.1",
"status": false
}
Example Response:
{
"id": 1,
"name": "Router-Main-01-Updated",
"type": 2,
"organization": 1,
"ip_address": "192.168.1.1",
"status": false,
"last_status_change": "2024-01-15T16:45:00Z",
"pending_settings": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T16:45:00Z"
}
| Status | Description |
|---|---|
| 200 | Updated successfully |
| 400 | Bad request - validation errors |
| 401 | Unauthorized |
| 404 | Device not found |
PATCH /inventory_device/{id}/
Partially update an inventory device record.
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes | Device ID |
| data | object | body | Yes | Partial device data object |
Example Request:
PATCH /api/v1/inventory_device/1/
Content-Type: application/json
{
"status": true,
"name": "Router-Main-01-Active"
}
Example Response:
{
"id": 1,
"name": "Router-Main-01-Active",
"type": 2,
"organization": 1,
"ip_address": "192.168.1.1",
"status": true,
"last_status_change": "2024-01-15T17:00:00Z",
"pending_settings": false,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-15T17:00:00Z"
}
| Status | Description |
|---|---|
| 200 | Updated successfully |
| 400 | Bad request - validation errors |
| 401 | Unauthorized |
| 404 | Device not found |
DELETE /inventory_device/{id}/
Delete an inventory device.
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes | Device ID |
Example Request:
DELETE /api/v1/inventory_device/1/
| Status | Description |
|---|---|
| 204 | Deleted successfully |
| 401 | Unauthorized |
| 404 | Device not found |
Best Practices
- Use the
update_status=trueparameter when you need real-time device status information - Filter by organization to improve performance when dealing with large device inventories
- Use pagination (
limitandoffset) for listing large numbers of devices - Monitor the
pending_settingsfield to identify devices that require configuration updates - Use PATCH instead of PUT for partial updates to avoid overwriting unchanged fields
- When filtering by status, use boolean values (
true/false) for consistency - Include proper error handling for 404 responses when accessing specific device IDs
- Use ISO format for datetime filters to ensure consistent results across timezones