Skip to main content

Inventory Device Name Headless Operation

Manage headless device operations for inventory devices, including listing scheduled transactions and creating new operations.

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

Authentication: All endpoints require a Bearer token:

Authorization: Bearer <your-api-token>

Endpoints

GET /inventory_device_name_headless_operation/

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

Parameters:

Parameter Type In Required Description
id string query No ID of the scheduled transaction to filter by
update_status boolean query No Use configured helpers to update device status before returning information
limit integer query No Number of results to return per page (default: 100)
offset integer query No The initial index from which to return results

Example Request:

GET /api/v1/inventory_device_name_headless_operation/?id=txn_123&update_status=true

Example Response:

{
  "count": 2,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": "txn_123",
      "device_name": "server-01",
      "operation_type": "reboot",
      "status": "pending",
      "scheduled_at": "2024-01-15T10:30:00Z",
      "created_at": "2024-01-15T09:15:00Z",
      "parameters": {
        "force": false,
        "timeout": 300
      }
    },
    {
      "id": "txn_124",
      "device_name": "workstation-05",
      "operation_type": "update",
      "status": "completed",
      "scheduled_at": "2024-01-15T08:00:00Z",
      "created_at": "2024-01-15T07:45:00Z",
      "parameters": {
        "package_list": ["security-updates"]
      }
    }
  ]
}
Status Description
200 Success
401 Unauthorized - Invalid or missing Bearer token
403 Forbidden - Insufficient permissions

POST /inventory_device_name_headless_operation/

Create a new headless operation for an inventory device. This endpoint schedules operations to be executed on devices without user interaction.

Parameters:

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

Example Request:

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

{
  "device_name": "server-02",
  "operation_type": "restart_service",
  "scheduled_at": "2024-01-15T14:00:00Z",
  "parameters": {
    "service_name": "nginx",
    "verify_status": true
  }
}

Example Response:

{
  "id": "txn_125",
  "device_name": "server-02",
  "operation_type": "restart_service",
  "status": "scheduled",
  "scheduled_at": "2024-01-15T14:00:00Z",
  "created_at": "2024-01-15T13:45:00Z",
  "parameters": {
    "service_name": "nginx",
    "verify_status": true
  },
  "estimated_duration": 120
}
Status Description
201 Created - Operation successfully scheduled
400 Bad Request - Invalid data format or missing required fields
401 Unauthorized - Invalid or missing Bearer token
403 Forbidden - Insufficient permissions
404 Not Found - Device name not found in inventory

Best Practices

  • Scheduling Operations: Always schedule operations during maintenance windows to minimize service disruption
  • Status Monitoring: Use the update_status=true parameter when you need real-time device status information
  • Error Handling: Check device availability before scheduling critical operations
  • Timeout Configuration: Set appropriate timeout values in parameters based on operation complexity
  • Batch Operations: For multiple devices, make separate API calls rather than batching in a single request
  • Status Polling: After creating an operation, poll the GET endpoint to monitor execution progress