Update rule
PATCH/rules/:id
Update rule.
Authorization Action:
ruleengine:rules:update
Request
Path Parameters
id stringrequired
- application/json
Bodyrequired
conditionsobject[]
tagsobject[]
namestring
severitystring
Possible values: [info, warning, critical]
descriptionstring
processablestring
Possible values: [enabled, disabled]
Default value:
enablednotification object
Responses
- 200
- 404
- 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": {
"source": "messages",
"metric": "urn:cpt:smartdevice:nid:D0CF5EFFFE26FDAB1:onoff",
"channelId": "string",
"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": [
{
"target": "string",
"policy": "trigger",
"medium": "email",
"text": "string"
}
]
},
"id": "string"
}
- 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.Patch, "https://connhex.com/rules/:id");
request.Headers.Add("Accept", "application/json");
var content = new StringContent("{\n \"conditions\": [\n {}\n ],\n \"tags\": [\n {}\n ],\n \"name\": \"string\",\n \"severity\": \"info\",\n \"description\": \"string\",\n \"processable\": \"enabled\",\n \"notification\": {\n \"messages\": [\n {\n \"target\": \"string\",\n \"policy\": \"trigger\",\n \"medium\": \"email\",\n \"text\": \"string\"\n }\n ]\n }\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());