Skip to main content

Update rule

PATCH 

/rules/:id

Update rule.

Authorization Action:

ruleengine:rules:update

Request

Path Parameters

    id stringrequired

Bodyrequired

    conditionsobject[]
    tagsobject[]
    namestring
    severitystring

    Possible values: [info, warning, critical]

    descriptionstring
    processablestring

    Possible values: [enabled, disabled]

    Default value: enabled
    notification object
    messages object[]required
  • Array [
  • targetstring

    Notification target: can be an email address, a phone number or a telegram account. If not specified, the notification target is set to the user that created the rule.

    policystringrequired

    Possible values: [trigger, reentry]

    mediumstringrequired

    Possible values: [email, telegram, sms, slack, discord, fcm, msteams]

    textstringrequired
  • ]

Responses

Schema
    conditions object[]required
  • Array [
  • params objectrequired
    oneOf
    sourcestring

    Possible values: [messages, params, metrics]

    metricstringrequired

    URN of the metric to be monitored

    Example: urn:cpt:smartdevice:nid:D0CF5EFFFE26FDAB1:onoff
    channelIdstring
    thresholdnumberrequired
    comparisonOperatorstringrequired

    Possible values: [>, >=, <, <=, ==, !=]

    unitstring
    Example: °C
    durationSecsnumberrequired

    Possible values: >= 0 and <= 86400

    activeWindow object
    fromstringrequired

    Possible values: Value must match regular expression /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/

    Example: 08:10
    tostringrequired

    Possible values: Value must match regular expression /^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/

    Example: 13:15
    timezonestringrequired

    IANA timezone identifier

    Example: Europe/Rome
    statusstringrequired

    Possible values: [active, inactive]

    createdAtstring<date-time>required
    updatedAtstring<date-time>required
    deletedAtstring<date-time>required
    typestringrequired

    Possible values: [threshold, lastMessageOlderThan, delta]

    idstringrequired
  • ]
  • tags object[]required
  • Array [
  • createdAtstring<date-time>required
    updatedAtstring<date-time>required
    deletedAtstring<date-time>required
    labelstringrequired
    labelValuestringrequired
    metadataobject

    Other custom properties associated to the tag

    idstringrequired
  • ]
  • 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: enabled
    notification objectrequired
    messages object[]required
  • Array [
  • targetstring

    Notification target: can be an email address, a phone number or a telegram account. If not specified, the notification target is set to the user that created the rule.

    policystringrequired

    Possible values: [trigger, reentry]

    mediumstringrequired

    Possible values: [email, telegram, sms, slack, discord, fcm, msteams]

    textstringrequired
  • ]
  • idstringrequired
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());
Request Collapse all
Parameters
— pathrequired
Body required
{
  "conditions": [
    {}
  ],
  "tags": [
    {}
  ],
  "name": "string",
  "severity": "info",
  "description": "string",
  "processable": "enabled",
  "notification": {
    "messages": [
      {
        "target": "string",
        "policy": "trigger",
        "medium": "email",
        "text": "string"
      }
    ]
  }
}