ApiDatabus metrics
Get machine aggregated metrics over a time window
Fetches machine aggregated metrics within a specified time range
Access restricted to roles:
- admin
- manufacturer-admin
- manufacturer-user
- producer-admin
- producer-user
Authorization
bearer AuthorizationBearer <token>
In: header
Path Parameters
machineId*string
UUID of the machine to query states for
Format
uuidQuery Parameters
metric*string
Metric name
aggregation?string
Aggregation type to apply to state values. Defaults to 'none'
Value in
"none" | "min" | "max" | "mean"limit?number
Maximum number of metrics to return
Default
10Range
1 <= value <= 100000startDate?unknown
Start of time window in UTC timezone. Accepted formats:
- ISO 8601 (e.g. "2025-06-10T10:07:13Z
- Duration (e.g. "-3d", "1h). Accepted units are: m (minutes), h (hours), d (days), w (weeks)
- Unix timestamp in milliseconds (e.g. 1752503444666)
- Special: "now"
Defaults to "-15m" if not provided.endDate?unknown
End of time window in UTC timezone. Accepted formats:
- ISO 8601 (e.g. "2025-06-14T23:59:59Z")
- Duration (e.g. "-1h", "3d")
- Unix timestamp in milliseconds (e.g. 1721068799000)
- Special: "now"
Defaults to "now" if not provided.Response Body
application/json
application/json
application/json
application/json
application/json
curl -X GET "https://test.sweetconnect.io/api/databus/v1/metrics/9488c561-749f-4b3d-8c2f-30e867ba66db/aggregated_metrics?metric=power_usage"{
"data": {
"type": "aggregated",
"metric": "WS_GOOD_PRODUCTS",
"time": 1756826815845,
"unit": "kg",
"data": [
{
"t": "2025-06-04T13:40:32Z",
"v": 23.5
}
]
}
}{
"errors": [
{
"errorCode": "RequestValidationError",
"message": "The 'username' field is required.",
"extension": {
"type": "body",
"key": "username"
}
}
]
}{
"errors": [
{
"errorCode": "Unauthorized",
"message": "Authentication is required to access this resource.",
"extension": {}
}
]
}{
"errors": [
{
"errorCode": "NoPermission",
"message": "You do not have permission to access this resource.",
"extension": {}
}
]
}{
"errors": [
{
"errorCode": "NotFound",
"message": "The requested resource was not found.",
"extension": {}
}
]
}