SweetConnect LogoSweetConnect
ApiDatabus metrics

Get failure statistics

Access restricted to roles:

  • admin
  • manufacturer-admin
  • manufacturer-user
  • producer-admin
  • producer-user
  • sales-agent
GET
/v1/metrics/failure-statistics
AuthorizationBearer <token>

In: header

Query Parameters

assetId*string

Required asset identifier

startDate?unknown

Start timestamp (e.g., '-24h')

endDate?unknown

End timestamp (e.g., 'now')

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://my.sweetconnect.io/api/databus/v1/metrics/failure-statistics?assetId=string"
{
  "buckets": [
    {
      "startDate": 1756823200000,
      "endDate": 1756826800000,
      "data": [
        {
          "assetId": "asset-123",
          "value": {
            "input": [
              {
                "type": "log",
                "time": 1756826815845,
                "value": "Aborted",
                "errorCode": 1
              },
              {
                "type": "log",
                "time": 1756826915845,
                "value": "Timeout",
                "errorCode": 2
              }
            ],
            "output": {
              "top5": [
                {
                  "errorCode": 1,
                  "value": "Aborted",
                  "count": 3,
                  "timestamps": [
                    1756823210000,
                    1756824510000,
                    1756826815845
                  ]
                },
                {
                  "errorCode": 2,
                  "value": "Timeout",
                  "count": 1,
                  "timestamps": [
                    1756826915845
                  ]
                }
              ],
              "totalFailures": 4,
              "failuresPerHour": [
                {
                  "hour": 10,
                  "count": 1
                },
                {
                  "hour": 11,
                  "count": 2
                },
                {
                  "hour": 12,
                  "count": 1
                }
              ]
            },
            "metadata": {
              "warnings": [
                {
                  "type": "stale",
                  "assetId": "asset-123",
                  "message": "Telemetry was stale for part of the interval.",
                  "occurrences": 2
                }
              ]
            }
          },
          "statistics": null
        }
      ]
    }
  ],
  "warnings": []
}
{
  "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": "InternalServerError",
      "message": "An unexpected error occurred. See logs for further details or create a support ticket.",
      "extension": {}
    }
  ]
}