Skip to main content

Inventory Device Setting

Manage device-specific configuration settings and parameters for inventory items.

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

Authentication: All endpoints require a Bearer token:

Authorization: Bearer <your-api-token>

Endpoints

GET /inventory_device_setting/

Retrieve a list of device settings filtered by various parameters.

Parameters:

Parameter Type In Required Description
parent_id integer query Yes Filter setting by 'parent ID' field
parameter_id string query No Filter by specific parameter ID
parameter__variable_name string query No Filter setting by 'parameter variable_name' field
parameter__name string query No Filter setting by 'parameter name' field
parameter__short_name string query No Filter setting by 'parameter short-name' field
pending boolean query No Report if setting is pending
limit integer query No Number of results to return per page
offset integer query No The initial index from which to return the results

Example Request:

GET /api/v1/inventory_device_setting/?parent_id=123&parameter__name=temperature&limit=10

Example Response:

{
  "count": 25,
  "next": "https://control.zequenze.com/api/v1/inventory_device_setting/?parent_id=123&offset=10",
  "previous": null,
  "results": [
    {
      "id": 1,
      "parent_id": 123,
      "parameter": {
        "id": "temp_001",
        "variable_name": "device_temperature",
        "name": "Temperature Setting",
        "short_name": "temp"
      },
      "value": "25.5",
      "pending": false,
      "last_updated": "2024-01-15T10:30:00Z"
    }
  ]
}
Status Description
200 Success
400 Bad request - missing required parent_id
401 Unauthorized

PUT /inventory_device_setting/{parent_id}/

Update device settings for a specific parent device.

Parameters:

Parameter Type In Required Description
parent_id integer path Yes ID of the parent device
data string body Yes JSON data containing setting updates

Example Request:

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

{
  "settings": [
    {
      "parameter_id": "temp_001",
      "value": "26.0"
    },
    {
      "parameter_id": "humidity_001", 
      "value": "45.5"
    }
  ]
}

Example Response:

{
  "success": true,
  "updated_count": 2,
  "settings": [
    {
      "id": 1,
      "parameter_id": "temp_001",
      "value": "26.0",
      "pending": true,
      "last_updated": "2024-01-15T11:45:00Z"
    },
    {
      "id": 2,
      "parameter_id": "humidity_001",
      "value": "45.5", 
      "pending": true,
      "last_updated": "2024-01-15T11:45:00Z"
    }
  ]
}
Status Description
200 Settings updated successfully
400 Invalid request data
401 Unauthorized
404 Parent device not found

PATCH /inventory_device_setting/{parent_id}/

Partially update specific device settings for a parent device.

Parameters:

Parameter Type In Required Description
parent_id integer path Yes ID of the parent device
data string body Yes JSON data containing partial setting updates

Example Request:

PATCH /api/v1/inventory_device_setting/123/
Content-Type: application/json

{
  "parameter_id": "temp_001",
  "value": "27.2"
}

Example Response:

{
  "id": 1,
  "parent_id": 123,
  "parameter": {
    "id": "temp_001",
    "variable_name": "device_temperature",
    "name": "Temperature Setting",
    "short_name": "temp"
  },
  "value": "27.2",
  "pending": true,
  "last_updated": "2024-01-15T12:00:00Z"
}
Status Description
200 Setting updated successfully
400 Invalid request data
401 Unauthorized
404 Parent device or setting not found

Best Practices

  • Always specify the parent_id when listing device settings to ensure proper filtering
  • Use the pending parameter to check if settings are awaiting synchronization with physical devices
  • Implement proper error handling for cases where parent devices don't exist
  • When updating multiple settings, prefer PUT over multiple PATCH requests for better performance
  • Use parameter filters (parameter__name, parameter__variable_name) to find specific setting types
  • Consider pagination with limit and offset when dealing with devices that have many settings
  • Monitor the pending status after updates to ensure settings are properly applied to devices