Skip to main content

Inventory Device Variables

Manage and configure device variables and parameters for inventory devices, including retrieval and bulk updates.

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

Authentication: All endpoints require a Bearer token:

Authorization: Bearer <your-api-token>

Endpoints

GET /inventory_device_variables/

Retrieve device variables and parameters for a specific inventory device. Supports filtering by parameter names, variable names, and various configuration options.

Parameters:

Parameter Type In Required Description
parent_id integer query Yes Filter setting by parent (device) ID
parameter__variable_name string query No Comma separated list of parameter 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 The initial index from which to return the results
pending boolean query No Include information if the parameter have pending changes to be applied
wildcard boolean query No Use wildcard ('*') character in variable name or parameter name fields
force_update boolean query No Force update device settings before getting the requested information
extra boolean query No Show additional/extra information of the parameters
dates boolean query No Show date information of the parameters

Example Request:

GET /api/v1/inventory_device_variables/?parent_id=123&parameter__name=hostname,ip_address&extra=true

Example Response:

{
  "count": 2,
  "results": [
    {
      "id": 1,
      "variable_name": "system_hostname",
      "parameter_name": "hostname",
      "short_name": "host",
      "value": "server01.example.com",
      "data_type": "string",
      "pending_changes": false,
      "last_modified": "2024-01-15T10:30:00Z",
      "extra_info": {
        "description": "System hostname configuration",
        "category": "network"
      }
    },
    {
      "id": 2,
      "variable_name": "network_ip_primary",
      "parameter_name": "ip_address",
      "short_name": "ip",
      "value": "192.168.1.100",
      "data_type": "ipv4",
      "pending_changes": true,
      "last_modified": "2024-01-15T14:20:00Z",
      "extra_info": {
        "description": "Primary IP address",
        "category": "network"
      }
    }
  ]
}
Status Description
200 Successfully retrieved device variables
400 Invalid parameters or missing required parent_id
401 Unauthorized - Invalid or missing API token
404 Device not found

PUT /inventory_device_variables/{parent_id}/

Update device variables and parameters for a specific inventory device. Allows bulk updates of multiple parameters in a single request.

Parameters:

Parameter Type In Required Description
parent_id integer path Yes The device ID to update variables for
data string body Yes JSON payload containing variable updates

Example Request:

PUT /api/v1/inventory_device_variables/123/
Content-Type: application/json

{
  "variables": [
    {
      "variable_name": "system_hostname",
      "value": "server01-updated.example.com"
    },
    {
      "variable_name": "network_ip_primary",
      "value": "192.168.1.101"
    },
    {
      "parameter_name": "snmp_community",
      "value": "public_readonly"
    }
  ],
  "apply_immediately": false,
  "validate_only": false
}

Example Response:

{
  "success": true,
  "updated_count": 3,
  "pending_changes": true,
  "validation_errors": [],
  "updated_variables": [
    {
      "variable_name": "system_hostname",
      "old_value": "server01.example.com",
      "new_value": "server01-updated.example.com",
      "status": "updated"
    },
    {
      "variable_name": "network_ip_primary",
      "old_value": "192.168.1.100",
      "new_value": "192.168.1.101",
      "status": "updated"
    },
    {
      "parameter_name": "snmp_community",
      "old_value": "public",
      "new_value": "public_readonly",
      "status": "updated"
    }
  ]
}
Status Description
200 Successfully updated device variables
400 Invalid request data or validation errors
401 Unauthorized - Invalid or missing API token
404 Device not found
422 Unprocessable entity - Invalid variable values

Best Practices

  • Use parent_id filtering: Always specify the parent_id parameter to retrieve variables for specific devices
  • Leverage wildcard searches: Use the wildcard=true parameter with asterisk (*) characters to find parameters with partial name matches
  • Batch updates efficiently: Use the PUT endpoint to update multiple variables in a single request rather than individual updates
  • Monitor pending changes: Use the pending=true parameter to track which parameters have changes waiting to be applied to the device
  • Validate before applying: Consider using validate_only=true in update requests to check parameter validity before committing changes
  • Handle pagination: Use limit and offset parameters for devices with large numbers of variables to avoid timeouts
  • Force updates when needed: Use force_update=true to ensure you're working with the latest device configuration data
  • Include extra information: Use extra=true and dates=true parameters when you need additional context about parameters and their modification history