Skip to main content

Inventory Device Diags

Manage device diagnostic information and status updates 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_diags/

Retrieve diagnostic information for inventory devices. Optionally 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_diags/?id=12345&update_status=true

Example Response:

{
  "count": 1,
  "results": [
    {
      "id": "12345",
      "device_id": "dev_abc123",
      "device_name": "Server-01",
      "status": "online",
      "last_check": "2023-12-01T10:30:00Z",
      "diagnostics": {
        "cpu_usage": 45.2,
        "memory_usage": 67.8,
        "disk_usage": 23.1,
        "network_status": "connected"
      },
      "alerts": [],
      "scheduled_transaction_id": "12345"
    }
  ]
}
Status Description
200 Diagnostic information retrieved successfully
401 Unauthorized
404 Device not found

POST /inventory_device_diags/

Create a new device diagnostic entry or scheduled diagnostic transaction.

Parameters:

Parameter Type In Required Description
data string body Yes JSON string containing diagnostic data

Example Request:

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

{
  "device_id": "dev_abc123",
  "diagnostic_type": "health_check",
  "schedule_time": "2023-12-01T15:00:00Z",
  "parameters": {
    "check_cpu": true,
    "check_memory": true,
    "check_disk": true,
    "check_network": true
  }
}

Example Response:

{
  "id": "67890",
  "device_id": "dev_abc123",
  "diagnostic_type": "health_check",
  "status": "scheduled",
  "schedule_time": "2023-12-01T15:00:00Z",
  "created_at": "2023-12-01T10:45:00Z",
  "parameters": {
    "check_cpu": true,
    "check_memory": true,
    "check_disk": true,
    "check_network": true
  }
}
Status Description
201 Diagnostic entry created successfully
400 Invalid data provided
401 Unauthorized
422 Validation error

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
  • Filtering: Use the id parameter to retrieve specific diagnostic transactions rather than fetching all results
  • Error Handling: Always check for HTTP status codes; devices may be offline or unreachable during diagnostic operations
  • Scheduling: When creating diagnostic entries, ensure schedule times are in the future and within reasonable limits
  • Rate Limiting: Avoid frequent status update requests to prevent overwhelming device endpoints
  • Data Format: Ensure the data parameter contains valid JSON when creating diagnostic entries