Skip to main content

Inventory Device Headless Operation

Manage headless operations for inventory devices, including scheduling and monitoring automated device tasks.

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

Authentication: All endpoints require a Bearer token:

Authorization: Bearer <your-api-token>

Endpoints

GET /inventory_device_headless_operation/

Retrieve a list of scheduled headless operations for inventory devices. Optionally filter by operation ID or update device status before returning results.

Parameters:

Parameter Type In Required Description
id string query No ID of the scheduled transaction
update_status boolean query No Use configured helpers to update device status before returning the information

Example Request:

GET /api/v1/inventory_device_headless_operation/?id=op_12345&update_status=true

Example Response:

{
  "count": 3,
  "results": [
    {
      "id": "op_12345",
      "device_id": "dev_67890",
      "operation_type": "firmware_update",
      "status": "pending",
      "scheduled_at": "2024-01-15T10:30:00Z",
      "created_at": "2024-01-15T09:15:00Z",
      "updated_at": "2024-01-15T09:15:00Z",
      "parameters": {
        "firmware_version": "2.1.3",
        "auto_reboot": true
      }
    },
    {
      "id": "op_12346",
      "device_id": "dev_67891",
      "operation_type": "configuration_sync",
      "status": "completed",
      "scheduled_at": "2024-01-15T08:00:00Z",
      "created_at": "2024-01-15T07:45:00Z",
      "updated_at": "2024-01-15T08:15:00Z",
      "parameters": {
        "config_template": "default_template"
      }
    }
  ]
}
Status Description
200 Successfully retrieved headless operations
401 Unauthorized - Invalid or missing Bearer token
403 Forbidden - Insufficient permissions

POST /inventory_device_headless_operation/

Schedule a new headless operation for an inventory device. The operation will be executed automatically at the specified time.

Parameters:

Parameter Type In Required Description
data string body Yes JSON string containing operation details

Example Request:

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

{
  "device_id": "dev_67892",
  "operation_type": "backup_configuration",
  "scheduled_at": "2024-01-16T02:00:00Z",
  "parameters": {
    "backup_location": "s3://backups/devices/",
    "compression": true,
    "retention_days": 30
  },
  "priority": "normal"
}

Example Response:

{
  "id": "op_12347",
  "device_id": "dev_67892",
  "operation_type": "backup_configuration",
  "status": "scheduled",
  "scheduled_at": "2024-01-16T02:00:00Z",
  "created_at": "2024-01-15T14:30:00Z",
  "updated_at": "2024-01-15T14:30:00Z",
  "parameters": {
    "backup_location": "s3://backups/devices/",
    "compression": true,
    "retention_days": 30
  },
  "priority": "normal"
}
Status Description
201 Operation successfully scheduled
400 Bad Request - Invalid parameters or malformed JSON
401 Unauthorized - Invalid or missing Bearer token
403 Forbidden - Insufficient permissions
404 Not Found - Specified device does not exist

Best Practices

  • Status Updates: Use the update_status=true parameter when you need real-time device status information, but be aware this may increase response time
  • Scheduling: Schedule operations during maintenance windows to minimize impact on device performance
  • Error Handling: Always check the operation status after creation and implement retry logic for failed operations
  • Filtering: Use the id parameter to track specific operations or implement polling for status updates
  • JSON Formatting: Ensure the data parameter contains properly escaped JSON when creating operations
  • Time Zones: All timestamps should be provided in UTC format (ISO 8601) to avoid scheduling conflicts