Create rule
POST/rules
Create rule.
Authorization Action:
ruleengine:rules:create
Request
- application/json
Body
required
name stringrequired
severity string
Possible values: [info
, warning
, critical
]
description string
processable string
Possible values: [enabled
, disabled
]
Default value: enabled
tags object[]
notification objectrequired
conditions object[]required
Responses
- 201
- 400
- application/json
- Schema
- Example (from schema)
Schema
conditions object[]required
tags object[]required
status stringrequired
Possible values: [active
, inactive
]
createdAt date-timerequired
updatedAt date-timerequired
deletedAt date-timerequired
name stringrequired
severity string
Possible values: [info
, warning
, critical
]
description string
processable string
Possible values: [enabled
, disabled
]
Default value: enabled
notification objectrequired
id stringrequired
{
"conditions": [
{
"params": {},
"status": "active",
"createdAt": "2024-08-30T08:48:05.877Z",
"updatedAt": "2024-08-30T08:48:05.877Z",
"deletedAt": "2024-08-30T08:48:05.877Z",
"type": "threshold",
"id": "string"
}
],
"tags": [
{
"createdAt": "2024-08-30T08:48:05.877Z",
"updatedAt": "2024-08-30T08:48:05.877Z",
"deletedAt": "2024-08-30T08:48:05.877Z",
"label": "string",
"labelValue": "string",
"metadata": {},
"id": "string"
}
],
"status": "active",
"createdAt": "2024-08-30T08:48:05.877Z",
"updatedAt": "2024-08-30T08:48:05.877Z",
"deletedAt": "2024-08-30T08:48:05.877Z",
"name": "string",
"severity": "info",
"description": "string",
"processable": "enabled",
"notification": {
"messages": [
{
"target": "string",
"policy": "trigger",
"medium": "email",
"text": "string"
}
]
},
"id": "string"
}
Missing user identity id
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X POST 'https://connhex.com/rules' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
--data-raw '{
"name": "string",
"severity": "info",
"description": "string",
"processable": "enabled",
"tags": [
{
"label": "string",
"labelValue": "string",
"metadata": {}
}
],
"notification": {
"messages": [
{
"target": "string",
"policy": "trigger",
"medium": "email",
"text": "string"
}
]
},
"conditions": [
{
"params": {
"metric": "urn:cpt:smartdevice:nid:D0CF5EFFFE26FDAB1:onoff",
"threshold": 0,
"comparisonOperator": ">",
"unit": "°C",
"durationSecs": 0,
"activeWindow": {
"from": "08:10",
"to": "13:15",
"timezone": "Europe/Rome"
}
},
"type": "threshold"
}
]
}'