Inventory Metric
The Inventory Metric API provides endpoints for retrieving information about metrics used to monitor and track inventory items. These endpoints allow you to list all available metrics with filtering capabilities and retrieve detailed information about specific metrics. Common use cases include building dashboards, configuring monitoring systems, and analyzing inventory performance data.
Base URL: https://control.zequenze.com/api/v1
Authentication: All endpoints require a Bearer token:
Authorization: Bearer <your-api-token>
Overview
The Inventory Metric API category enables you to access and manage inventory metrics within your monitoring and tracking system. Inventory metrics are measurements that help you track various aspects of your inventory items, such as stock levels, performance indicators, or operational statistics.
These endpoints are essential for:
- Dashboard Creation: Building custom dashboards that display real-time inventory metrics
- Monitoring Integration: Connecting your inventory system to monitoring tools and alerting systems
- Reporting and Analytics: Extracting metric definitions for reporting tools and data analysis platforms
- Configuration Management: Understanding available metrics when setting up automated inventory tracking
The API supports three types of metrics:
- Absolute (a): Point-in-time measurements (e.g., current stock level)
- Counter (c): Cumulative values that only increase (e.g., total items sold)
- Delta (d): Change-based measurements (e.g., stock movement over time)
Each metric can be associated with a group for organization and may include parameters for customization.
Endpoints
GET /inventory_metric/
Description: Retrieves a paginated list of all inventory metrics in the system. This endpoint supports filtering by metric name and includes pagination controls for handling large datasets. Use this endpoint when you need to browse available metrics, search for specific metrics by name, or build metric selection interfaces.
Use Cases:
- Building a dropdown list of available metrics for dashboard configuration
- Searching for metrics with specific names or patterns
- Retrieving all metrics for bulk operations or synchronization
- Implementing metric discovery in monitoring applications
Full URL Example:
https://control.zequenze.com/api/v1/inventory_metric/?name=stock_level&limit=25&offset=0
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| name | string | query | No | Filter metrics by partial or exact name match. Case-sensitive search on the metric's name field |
| limit | integer | query | No | Number of results to return per page (default pagination limit applies if not specified) |
| offset | integer | query | No | Starting position for results, used for pagination (0-based indexing) |
cURL Example:
curl -X GET "https://control.zequenze.com/api/v1/inventory_metric/?name=stock&limit=10&offset=0" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Example Response:
{
"count": 25,
"next": "https://control.zequenze.com/api/v1/inventory_metric/?limit=10&offset=10",
"previous": null,
"results": [
{
"id": 1,
"name": "stock_level_current",
"group": 2,
"description": "Current inventory stock level for items",
"type": "a",
"parameter": 101
},
{
"id": 2,
"name": "stock_movement_delta",
"group": 2,
"description": "Change in stock levels over specified time period",
"type": "d",
"parameter": 102
},
{
"id": 3,
"name": "total_items_processed",
"group": 1,
"description": "Cumulative count of items processed through inventory",
"type": "c",
"parameter": null
}
]
}
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - Returns paginated list of inventory metrics |
| 401 | Unauthorized - Invalid or missing Bearer token |
| 400 | Bad Request - Invalid query parameters (e.g., negative offset) |
GET /inventory_metric/{id}/
Description: Retrieves detailed information about a specific inventory metric by its unique ID. This endpoint returns complete metric information including its type, description, group association, and parameter configuration. Use this endpoint when you need full details about a specific metric for configuration or display purposes.
Use Cases:
- Displaying detailed metric information in configuration interfaces
- Validating metric properties before using in monitoring systems
- Retrieving metric specifications for documentation or reporting
- Getting complete metric data for integration with third-party tools
Full URL Example:
https://control.zequenze.com/api/v1/inventory_metric/1/
Parameters:
| Parameter | Type | In | Required | Description |
|---|---|---|---|---|
| id | integer | path | Yes | Unique identifier of the inventory metric to retrieve |
| name | string | query | No | Additional filter by metric name (typically not needed when using ID) |
cURL Example:
curl -X GET "https://control.zequenze.com/api/v1/inventory_metric/1/" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json"
Example Response:
{
"id": 1,
"name": "warehouse_capacity_utilization",
"group": 3,
"description": "Percentage of warehouse capacity currently being utilized across all inventory locations",
"type": "a",
"parameter": 205
}
Response Codes:
| Status | Description |
|---|---|
| 200 | Success - Returns the requested inventory metric details |
| 401 | Unauthorized - Invalid or missing Bearer token |
| 404 | Not Found - Metric with specified ID does not exist |
| 400 | Bad Request - Invalid ID format |
Common Use Cases
Use Case 1: Building a Monitoring Dashboard
Retrieve all available metrics using the list endpoint, then fetch detailed information for selected metrics to build comprehensive monitoring dashboards. Filter by metric type to separate real-time values (absolute) from cumulative counters and change indicators.
Use Case 2: Configuring Inventory Alerts
Use the list endpoint to discover available metrics, then retrieve specific metric details to understand their types and parameters for setting up automated alerts when inventory thresholds are reached.
Use Case 3: Metric Discovery for Third-Party Integration
Programmatically discover all available inventory metrics using the list endpoint with pagination, then use the detail endpoint to gather complete specifications needed for integrating with external monitoring or analytics platforms.
Use Case 4: Inventory Reporting Setup
Search for specific metrics by name pattern using the name filter, then retrieve detailed information about selected metrics to configure automated inventory reports that track stock levels, movement, and performance indicators.
Best Practices
- Use Pagination Effectively: When retrieving large numbers of metrics, implement proper pagination using limit and offset parameters to avoid performance issues and timeouts
- Cache Metric Definitions: Metric definitions typically don't change frequently, so consider caching the results to reduce API calls and improve application performance
- Filter Early: Use the name parameter to filter metrics on the server side rather than retrieving all metrics and filtering client-side
- Handle Metric Types Appropriately: Understand the difference between absolute, counter, and delta metrics to properly interpret and display metric data in your applications
- Error Handling: Always implement proper error handling for 404 responses when requesting specific metrics by ID, as metrics may be removed or renamed
- Security: Store API tokens securely and use environment variables rather than hardcoding tokens in your applications
- Rate Limiting: Implement appropriate rate limiting in your applications to avoid overwhelming the API, especially when making bulk requests