Skip to main content

Inventory Device Serial

Manage inventory devices through CRUD operations using device serial numbers as identifiers.

Base URL: https://control.zequenze.com/api/v1

Authentication: All endpoints require a Bearer token:

Authorization: Bearer <your-api-token>

Endpoints

GET /inventory_device_serial/

Retrieve a list of inventory devices with optional filtering capabilities.

Parameters:

Parameter Type In Required Description
type integer query No Filter device by device 'type' ID field
status string query No Filter by device 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 organization ID
limit integer query No Number of results to return per page
offset integer query No The initial index from which to return 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 information

Example Request:

GET /api/v1/inventory_device_serial/?status=true&organization=1&limit=10

Example Response:

{
  "count": 25,
  "next": "https://control.zequenze.com/api/v1/inventory_device_serial/?limit=10&offset=10",
  "previous": null,
  "results": [
    {
      "serial_number": "ABC123DEF456",
      "name": "Office Router Main",
      "type": 1,
      "organization": 1,
      "status": true,
      "last_status_change": "2024-01-15T10:30:00Z",
      "pending_settings": false,
      "created_at": "2024-01-10T09:00:00Z",
      "updated_at": "2024-01-15T10:30:00Z"
    }
  ]
}
Status Description
200 Success
401 Unauthorized

POST /inventory_device_serial/

Create a new inventory device.

Parameters:

Parameter Type In Required Description
data string body Yes JSON payload containing device information

Example Request:

POST /api/v1/inventory_device_serial/
Content-Type: application/json

{
  "serial_number": "XYZ789GHI012",
  "name": "New Branch Router",
  "type": 2,
  "organization": 1,
  "status": true
}

Example Response:

{
  "serial_number": "XYZ789GHI012",
  "name": "New Branch Router",
  "type": 2,
  "organization": 1,
  "status": true,
  "last_status_change": "2024-01-16T14:20:00Z",
  "pending_settings": false,
  "created_at": "2024-01-16T14:20:00Z",
  "updated_at": "2024-01-16T14:20:00Z"
}
Status Description
201 Created successfully
400 Bad request
401 Unauthorized

GET /inventory_device_serial/{serial_number}/

Retrieve details of a specific inventory device by serial number.

Parameters:

Parameter Type In Required Description
serial_number string path Yes Device serial number
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 information

Example Request:

GET /api/v1/inventory_device_serial/ABC123DEF456/?update_status=true

Example Response:

{
  "serial_number": "ABC123DEF456",
  "name": "Office Router Main",
  "type": 1,
  "organization": 1,
  "status": true,
  "last_status_change": "2024-01-15T10:30:00Z",
  "pending_settings": false,
  "created_at": "2024-01-10T09:00:00Z",
  "updated_at": "2024-01-15T10:30:00Z"
}
Status Description
200 Success
404 Device not found
401 Unauthorized

PUT /inventory_device_serial/{serial_number}/

Completely update an existing inventory device.

Parameters:

Parameter Type In Required Description
serial_number string path Yes Device serial number
data string body Yes JSON payload containing complete device information

Example Request:

PUT /api/v1/inventory_device_serial/ABC123DEF456/
Content-Type: application/json

{
  "serial_number": "ABC123DEF456",
  "name": "Updated Office Router",
  "type": 1,
  "organization": 2,
  "status": false
}

Example Response:

{
  "serial_number": "ABC123DEF456",
  "name": "Updated Office Router",
  "type": 1,
  "organization": 2,
  "status": false,
  "last_status_change": "2024-01-16T15:45:00Z",
  "pending_settings": true,
  "created_at": "2024-01-10T09:00:00Z",
  "updated_at": "2024-01-16T15:45:00Z"
}
Status Description
200 Updated successfully
404 Device not found
400 Bad request
401 Unauthorized

PATCH /inventory_device_serial/{serial_number}/

Partially update an existing inventory device.

Parameters:

Parameter Type In Required Description
serial_number string path Yes Device serial number
data string body Yes JSON payload containing fields to update

Example Request:

PATCH /api/v1/inventory_device_serial/ABC123DEF456/
Content-Type: application/json

{
  "name": "Partially Updated Router",
  "status": true
}

Example Response:

{
  "serial_number": "ABC123DEF456",
  "name": "Partially Updated Router",
  "type": 1,
  "organization": 2,
  "status": true,
  "last_status_change": "2024-01-16T16:00:00Z",
  "pending_settings": false,
  "created_at": "2024-01-10T09:00:00Z",
  "updated_at": "2024-01-16T16:00:00Z"
}
Status Description
200 Updated successfully
404 Device not found
400 Bad request
401 Unauthorized

DELETE /inventory_device_serial/{serial_number}/

Delete an existing inventory device.

Parameters:

Parameter Type In Required Description
serial_number string path Yes Device serial number

Example Request:

DELETE /api/v1/inventory_device_serial/ABC123DEF456/
Status Description
204 Deleted successfully
404 Device not found
401 Unauthorized

Best Practices

  • Use the update_status parameter when you need real-time device status information
  • Implement proper error handling for device not found scenarios (404 responses)
  • Use pagination parameters (limit and offset) for large device inventories to improve performance
  • Filter by organization when working in multi-tenant environments to scope results appropriately
  • Check the pending_settings field to identify devices that require configuration updates
  • Use PATCH for partial updates to avoid overwriting unchanged fields
  • Serial numbers are case-sensitive identifiers - ensure exact matches when querying specific devices