Inventory Metric Log
Retrieve and filter inventory metric log data with datetime range and device/parameter filtering capabilities.
Base URL: https://control.zequenze.com/api/v1
Authentication: All endpoints require a Bearer token:
Authorization: Bearer <your-api-token>
Endpoints
GET /inventory_metric_log/
Retrieve a paginated list of inventory metric logs with advanced filtering options for datetime ranges, devices, and parameters.
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| datetime__gte | string | query | No | Filter records from this datetime (ISO format: 2000-01-01, 2000-01-01 00:01:00, 2000-01-01 00:01:00+00:00) |
| datetime__lte | string | query | No | Filter records until this datetime (ISO format: 2000-01-01, 2000-01-01 00:01:00, 2000-01-01 00:01:00+00:00) |
| device__name | string | query | No | Filter by device name |
| metric__name | string | query | No | Filter by metric name |
| parameter__name | string | query | No | Filter by parameter name |
| parameter__short_name | string | query | No | Filter by parameter short name |
| parameter__variable_name | string | query | No | Filter by parameter variable name |
| cursor | string | query | No | Pagination cursor for navigating results |
| limit | integer | query | No | Number of results per page (default pagination applies) |
| metric_name | string | query | No | Alternative filter for parameter name |
| parameter_name | string | query | No | Alternative filter for parameter name |
Example Request:
GET /api/v1/inventory_metric_log/?datetime__gte=2024-01-01&device__name=sensor-01&limit=50
Authorization: Bearer <your-api-token>
Example Response:
{
"count": 1250,
"next": "https://control.zequenze.com/api/v1/inventory_metric_log/?cursor=eyJkYXRldGltZSI6IjIwMjQtMDEtMDIifQ",
"previous": null,
"results": [
{
"id": 12345,
"datetime": "2024-01-02T10:30:00Z",
"device": {
"name": "sensor-01",
"id": 101
},
"metric": {
"name": "temperature_reading",
"id": 501
},
"parameter": {
"name": "Temperature",
"short_name": "temp",
"variable_name": "temp_celsius",
"id": 301
},
"value": 23.5,
"unit": "°C",
"created_at": "2024-01-02T10:30:15Z"
},
{
"id": 12346,
"datetime": "2024-01-02T10:35:00Z",
"device": {
"name": "sensor-01",
"id": 101
},
"metric": {
"name": "humidity_reading",
"id": 502
},
"parameter": {
"name": "Humidity",
"short_name": "humid",
"variable_name": "humidity_percent",
"id": 302
},
"value": 65.2,
"unit": "%",
"created_at": "2024-01-02T10:35:12Z"
}
]
}
| Status | Description |
|---|---|
| 200 | Successfully retrieved metric logs |
| 401 | Unauthorized - Invalid or missing Bearer token |
| 400 | Bad Request - Invalid datetime format or parameters |
GET /inventory_metric_log/{id}/
Retrieve a specific inventory metric log entry by its unique identifier.
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes | Unique identifier of the metric log entry |
| datetime__gte | string | query | No | Filter by datetime greater than or equal to (ISO format) |
| datetime__lte | string | query | No | Filter by datetime less than or equal to (ISO format) |
| device__name | string | query | No | Filter by device name |
| metric_name | string | query | No | Filter by parameter name |
| parameter_name | string | query | No | Filter by parameter name |
| parameter__variable_name | string | query | No | Filter by parameter variable name |
Example Request:
GET /api/v1/inventory_metric_log/12345/
Authorization: Bearer <your-api-token>
Example Response:
{
"id": 12345,
"datetime": "2024-01-02T10:30:00Z",
"device": {
"name": "sensor-01",
"id": 101,
"location": "Building A - Floor 2",
"type": "temperature_sensor"
},
"metric": {
"name": "temperature_reading",
"id": 501,
"description": "Ambient temperature measurement",
"frequency": "5_minutes"
},
"parameter": {
"name": "Temperature",
"short_name": "temp",
"variable_name": "temp_celsius",
"id": 301,
"unit": "°C",
"data_type": "float"
},
"value": 23.5,
"unit": "°C",
"quality": "good",
"status": "active",
"created_at": "2024-01-02T10:30:15Z",
"updated_at": "2024-01-02T10:30:15Z"
}
| Status | Description |
|---|---|
| 200 | Successfully retrieved metric log entry |
| 401 | Unauthorized - Invalid or missing Bearer token |
| 404 | Not Found - Metric log entry with specified ID does not exist |
| 400 | Bad Request - Invalid ID format or query parameters |
Best Practices
- DateTime Filtering: Use ISO 8601 format for datetime parameters. Supports date-only (2024-01-01), datetime (2024-01-01 10:30:00), and timezone-aware formats (2024-01-01 10:30:00+00:00)
-
Pagination: Use the
cursorparameter for efficient pagination through large datasets rather than offset-based pagination - Performance: Combine filters to reduce response size and improve query performance, especially when dealing with large time ranges
- Rate Limiting: Implement appropriate delays between requests when processing large datasets to avoid hitting API rate limits
- Caching: Consider caching responses for frequently accessed metric logs that don't change often
- Error Handling: Always check response status codes and implement retry logic for transient failures