This is a development version of the documentation. Content may change without notice.
Voke Documentation
ReferenceREST API

Alert rules

Alert rule management

List alert rules

GET
/api/v1/alert-rules

Query Parameters

page?number

Page number (1-indexed)

Default1
Range1 <= value
limit?number

Items per page

Default20
Range1 <= value <= 100
plantId?string

Filter by plant UUID

Formatuuid

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://loading/api/v1/alert-rules"
{
  "data": [
    {
      "condition": "LT",
      "cooldownMinutes": 0,
      "createdAt": "2019-08-24T14:15:22Z",
      "enabled": true,
      "id": "string",
      "lastTriggeredAt": "2019-08-24T14:15:22Z",
      "metric": "string",
      "name": "string",
      "organizationId": "string",
      "plantId": "string",
      "severity": "INFO",
      "threshold": 0,
      "updatedAt": "2019-08-24T14:15:22Z"
    }
  ],
  "meta": {
    "limit": 0,
    "page": 0,
    "total": 0,
    "totalPages": 0
  }
}
{
  "code": "VALIDATION_ERROR",
  "details": {},
  "error": "Bad Request",
  "message": "Validation error",
  "statusCode": 400
}
{
  "code": "UNAUTHORIZED",
  "details": {},
  "error": "Unauthorized",
  "message": "Unauthorized",
  "statusCode": 400
}
{
  "code": "FORBIDDEN",
  "details": {},
  "error": "Forbidden",
  "message": "Forbidden",
  "statusCode": 400
}
{
  "code": "INTERNAL_SERVER_ERROR",
  "details": {},
  "error": "Internal Server Error",
  "message": "Internal server error",
  "statusCode": 400
}

Create an alert rule

POST
/api/v1/alert-rules

Request Body

application/json

condition*string

Comparison condition

Value in"LT" | "GT" | "EQ"
cooldownMinutes?number

Cooldown between triggers in minutes

Default15
Range1 <= value <= 1440
enabled?boolean

Whether the rule is enabled

Defaulttrue
metric*string

Telemetry metric to monitor

Lengthlength <= 100
name*string

Rule name

Lengthlength <= 200
plantId?string

Restrict to a specific plant (null = all plants in org)

Formatuuid
severity?string

Alert severity when triggered

Default"WARNING"
Value in"INFO" | "WARNING" | "CRITICAL" | "EMERGENCY"
threshold*number

Threshold value

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://loading/api/v1/alert-rules" \  -H "Content-Type: application/json" \  -d '{    "condition": "LT",    "metric": "soc",    "name": "High SOC alert",    "threshold": 90  }'
{
  "condition": "LT",
  "cooldownMinutes": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "enabled": true,
  "id": "string",
  "lastTriggeredAt": "2019-08-24T14:15:22Z",
  "metric": "string",
  "name": "string",
  "organizationId": "string",
  "plantId": "string",
  "severity": "INFO",
  "threshold": 0,
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "code": "VALIDATION_ERROR",
  "details": {},
  "error": "Bad Request",
  "message": "Validation error or plant tenancy violation",
  "statusCode": 400
}
{
  "code": "UNAUTHORIZED",
  "details": {},
  "error": "Unauthorized",
  "message": "Unauthorized",
  "statusCode": 400
}
{
  "code": "FORBIDDEN",
  "details": {},
  "error": "Forbidden",
  "message": "Forbidden",
  "statusCode": 400
}
{
  "code": "INTERNAL_SERVER_ERROR",
  "details": {},
  "error": "Internal Server Error",
  "message": "Internal server error",
  "statusCode": 400
}

Get alert rule by ID

GET
/api/v1/alert-rules/{id}

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "https://loading/api/v1/alert-rules/string"
{
  "condition": "LT",
  "cooldownMinutes": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "enabled": true,
  "id": "string",
  "lastTriggeredAt": "2019-08-24T14:15:22Z",
  "metric": "string",
  "name": "string",
  "organizationId": "string",
  "plantId": "string",
  "severity": "INFO",
  "threshold": 0,
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "code": "INVALID_UUID",
  "details": {},
  "error": "Bad Request",
  "message": "Invalid UUID",
  "statusCode": 400
}
{
  "code": "UNAUTHORIZED",
  "details": {},
  "error": "Unauthorized",
  "message": "Unauthorized",
  "statusCode": 400
}
{
  "code": "FORBIDDEN",
  "details": {},
  "error": "Forbidden",
  "message": "Forbidden",
  "statusCode": 400
}
{
  "code": "NOT_FOUND",
  "details": {},
  "error": "Not Found",
  "message": "Alert rule not found",
  "statusCode": 400
}
{
  "code": "INTERNAL_SERVER_ERROR",
  "details": {},
  "error": "Internal Server Error",
  "message": "Internal server error",
  "statusCode": 400
}

Update an alert rule

PATCH
/api/v1/alert-rules/{id}

Path Parameters

id*string

Request Body

application/json

condition?string

Comparison condition

Value in"LT" | "GT" | "EQ"
cooldownMinutes?number

Cooldown between triggers in minutes

Default15
Range1 <= value <= 1440
enabled?boolean

Whether the rule is enabled

Defaulttrue
metric?string

Telemetry metric to monitor

Lengthlength <= 100
name?string

Rule name

Lengthlength <= 200
plantId?string

Restrict to a specific plant (null = all plants in org)

Formatuuid
severity?string

Alert severity when triggered

Default"WARNING"
Value in"INFO" | "WARNING" | "CRITICAL" | "EMERGENCY"
threshold?number

Threshold value

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X PATCH "https://loading/api/v1/alert-rules/string" \  -H "Content-Type: application/json" \  -d '{}'
{
  "condition": "LT",
  "cooldownMinutes": 0,
  "createdAt": "2019-08-24T14:15:22Z",
  "enabled": true,
  "id": "string",
  "lastTriggeredAt": "2019-08-24T14:15:22Z",
  "metric": "string",
  "name": "string",
  "organizationId": "string",
  "plantId": "string",
  "severity": "INFO",
  "threshold": 0,
  "updatedAt": "2019-08-24T14:15:22Z"
}
{
  "code": "VALIDATION_ERROR",
  "details": {},
  "error": "Bad Request",
  "message": "Validation error or plant tenancy violation",
  "statusCode": 400
}
{
  "code": "UNAUTHORIZED",
  "details": {},
  "error": "Unauthorized",
  "message": "Unauthorized",
  "statusCode": 400
}
{
  "code": "FORBIDDEN",
  "details": {},
  "error": "Forbidden",
  "message": "Forbidden",
  "statusCode": 400
}
{
  "code": "NOT_FOUND",
  "details": {},
  "error": "Not Found",
  "message": "Alert rule not found",
  "statusCode": 400
}
{
  "code": "INTERNAL_SERVER_ERROR",
  "details": {},
  "error": "Internal Server Error",
  "message": "Internal server error",
  "statusCode": 400
}

Delete an alert rule

DELETE
/api/v1/alert-rules/{id}

Path Parameters

id*string

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X DELETE "https://loading/api/v1/alert-rules/string"
Empty
{
  "code": "INVALID_UUID",
  "details": {},
  "error": "Bad Request",
  "message": "Invalid UUID",
  "statusCode": 400
}
{
  "code": "UNAUTHORIZED",
  "details": {},
  "error": "Unauthorized",
  "message": "Unauthorized",
  "statusCode": 400
}
{
  "code": "FORBIDDEN",
  "details": {},
  "error": "Forbidden",
  "message": "Forbidden",
  "statusCode": 400
}
{
  "code": "NOT_FOUND",
  "details": {},
  "error": "Not Found",
  "message": "Alert rule not found",
  "statusCode": 400
}
{
  "code": "INTERNAL_SERVER_ERROR",
  "details": {},
  "error": "Internal Server Error",
  "message": "Internal server error",
  "statusCode": 400
}