Skip to main content

Inventory Device Serial Variables

Manage device serial variables and parameters for inventory devices.

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_variables/

Retrieve device serial variables and parameters filtered by device serial number. This endpoint allows you to fetch configuration variables and their values for specific devices in your inventory.

Parameters:

Parameter Type In Required Description
parent__serial_number string query Yes Filter by device serial number
parameter__variable_name string query No Comma-separated list of variable names to retrieve
parameter__name string query No Comma-separated list of parameter names to retrieve
parameter__short_name string query No Comma-separated list of parameter short names to retrieve
limit integer query No Number of results to return per page
offset integer query No Initial index for paginated results
pending boolean query No Show if device has pending settings
wildcard boolean query No Enable wildcard ('*') matching for variable/parameter names
extra boolean query No Include additional parameter information

Example Request:

GET /api/v1/inventory_device_serial_variables/?parent__serial_number=ABC123456&parameter__variable_name=firmware_version,device_name&extra=true

Example Response:

{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1,
      "parent_serial_number": "ABC123456",
      "parameter": {
        "variable_name": "firmware_version",
        "name": "Firmware Version",
        "short_name": "fw_ver",
        "data_type": "string",
        "description": "Current firmware version"
      },
      "value": "2.1.4",
      "pending": false,
      "last_updated": "2024-01-15T10:30:00Z"
    },
    {
      "id": 2,
      "parent_serial_number": "ABC123456",
      "parameter": {
        "variable_name": "device_name",
        "name": "Device Name",
        "short_name": "name",
        "data_type": "string",
        "description": "Human readable device name"
      },
      "value": "Production Router 01",
      "pending": true,
      "last_updated": "2024-01-15T11:45:00Z"
    }
  ]
}
Status Description
200 Successfully retrieved device variables
400 Invalid parameters or missing required serial number
401 Unauthorized - invalid or missing Bearer token
404 Device with specified serial number not found

PUT /inventory_device_serial_variables/{parent__serial_number}/

Update device serial variables for a specific device. This endpoint allows bulk updating of configuration variables and parameters for inventory devices.

Parameters:

Parameter Type In Required Description
parent__serial_number string path Yes Serial number of the target device
data string body Yes JSON string containing variable updates

Example Request:

PUT /api/v1/inventory_device_serial_variables/ABC123456/
Content-Type: application/json

{
  "variables": [
    {
      "variable_name": "device_name",
      "value": "Updated Router Name"
    },
    {
      "variable_name": "location",
      "value": "Data Center A - Rack 15"
    },
    {
      "variable_name": "maintenance_window",
      "value": "Sunday 02:00-04:00 UTC"
    }
  ]
}

Example Response:

{
  "updated": 3,
  "results": [
    {
      "variable_name": "device_name",
      "value": "Updated Router Name",
      "status": "updated",
      "pending": true
    },
    {
      "variable_name": "location", 
      "value": "Data Center A - Rack 15",
      "status": "updated",
      "pending": true
    },
    {
      "variable_name": "maintenance_window",
      "value": "Sunday 02:00-04:00 UTC",
      "status": "updated",
      "pending": true
    }
  ],
  "message": "Device variables updated successfully"
}
Status Description
200 Variables updated successfully
400 Invalid data format or missing required fields
401 Unauthorized - invalid or missing Bearer token
404 Device with specified serial number not found
422 Validation errors in variable data

Best Practices

  • Use specific filters: When retrieving variables, use parameter__variable_name or parameter__name filters to limit results to only the variables you need
  • Enable wildcard matching: Set wildcard=true when using pattern matching with asterisks (*) in variable names
  • Check pending status: Use the pending parameter to identify devices with configuration changes that haven't been applied yet
  • Batch updates efficiently: When updating multiple variables, include them all in a single PUT request rather than making individual calls
  • Handle pagination: For devices with many variables, use limit and offset parameters to manage large result sets
  • Validate data types: Ensure variable values match the expected data type defined in the parameter configuration
  • Monitor update status: After updates, check the pending field to track when changes are applied to devices