create
POST/rules
create
Request
- application/json
Bodyrequired
namestringrequired
severitystring
Possible values: [info, warning, critical]
descriptionstring
processablestring
Possible values: [enabled, disabled]
Default value:
enabledtags object[]
notification objectrequired
conditions object[]required
Responses
- 201
- 400
- application/json
- Schema
- Example (auto)
Schema
conditions object[]required
tags object[]required
statusstringrequired
Possible values: [active, inactive]
createdAtstring<date-time>required
updatedAtstring<date-time>required
deletedAtstring<date-time>required
namestringrequired
severitystring
Possible values: [info, warning, critical]
descriptionstring
processablestring
Possible values: [enabled, disabled]
Default value:
enablednotification objectrequired
idstringrequired
{
"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"
}
},
"status": "active",
"createdAt": "2024-07-29T15:51:28.071Z",
"updatedAt": "2024-07-29T15:51:28.071Z",
"deletedAt": "2024-07-29T15:51:28.071Z",
"type": "threshold",
"id": "string"
}
],
"tags": [
{
"createdAt": "2024-07-29T15:51:28.071Z",
"updatedAt": "2024-07-29T15:51:28.071Z",
"deletedAt": "2024-07-29T15:51:28.071Z",
"label": "string",
"labelValue": "string",
"metadata": {},
"id": "string"
}
],
"status": "active",
"createdAt": "2024-07-29T15:51:28.071Z",
"updatedAt": "2024-07-29T15:51:28.071Z",
"deletedAt": "2024-07-29T15:51:28.071Z",
"name": "string",
"severity": "info",
"description": "string",
"processable": "enabled",
"notification": {
"messages": [
{
"policy": "trigger",
"medium": "email",
"text": "string"
}
]
},
"id": "string"
}
Missing user identity id
- csharp
- curl
- dart
- go
- http
- java
- javascript
- kotlin
- c
- nodejs
- objective-c
- ocaml
- php
- powershell
- python
- r
- ruby
- rust
- shell
- swift
- HTTPCLIENT
- RESTSHARP
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://connhex.com/rules");
request.Headers.Add("Accept", "application/json");
var content = new StringContent("{\n \"name\": \"string\",\n \"severity\": \"info\",\n \"description\": \"string\",\n \"processable\": \"enabled\",\n \"tags\": [\n {\n \"label\": \"string\",\n \"labelValue\": \"string\",\n \"metadata\": {}\n }\n ],\n \"notification\": {\n \"messages\": [\n {\n \"policy\": \"trigger\",\n \"medium\": \"email\",\n \"text\": \"string\"\n }\n ]\n },\n \"conditions\": [\n {\n \"params\": {\n \"metric\": \"urn:cpt:smartdevice:nid:D0CF5EFFFE26FDAB1:onoff\",\n \"threshold\": 0,\n \"comparisonOperator\": \">\",\n \"unit\": \"°C\",\n \"durationSecs\": 0,\n \"activeWindow\": {\n \"from\": \"08:10\",\n \"to\": \"13:15\",\n \"timezone\": \"Europe/Rome\"\n }\n },\n \"type\": \"threshold\"\n }\n ]\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());