API DocsRESTRule service

CreateRule

Creates a rule.

POST
/api/v1/rules

Request Body

application/jsonRequired

update
Required
object

UpdateRuleRequest is used to create or update a rule. If the rule_id or client_key is provided, the rule will be updated. If not, a new rule will be created.

curl -X POST "<API_URL>/api/v1/rules" \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "update": {
      "ruleId": "string",
      "name": "string",
      "description": "string",
      "assetId": "string",
      "isEnabled": true,
      "conditions": [
        {
          "ruleConditionId": "string",
          "expression": {
            "singleChannelComparison": {
              "channelComponent": "string",
              "channelName": "string",
              "comparator": "CONDITION_COMPARATOR_UNSPECIFIED",
              "double": 0.1,
              "string": "string",
              "lastValue": {}
            },
            "calculatedChannel": {
              "channelReferences": {
                "property1": {
                  "name": "string",
                  "component": "string"
                },
                "property2": {
                  "name": "string",
                  "component": "string"
                }
              },
              "expression": "string"
            }
          },
          "actions": [
            {
              "ruleActionId": "string",
              "actionType": "ACTION_KIND_UNSPECIFIED",
              "configuration": {
                "notification": {
                  "recipientUserIds": [
                    "string"
                  ]
                },
                "annotation": {
                  "tagIds": [
                    "string"
                  ],
                  "annotationType": "ANNOTATION_TYPE_UNSPECIFIED",
                  "assignedToUserId": "string"
                }
              }
            }
          ]
        }
      ],
      "organizationId": "string",
      "versionNotes": "string",
      "clientKey": "string",
      "assetConfiguration": {
        "assetIds": [
          "string"
        ],
        "tagIds": [
          "string"
        ]
      },
      "contextualChannels": {
        "channels": [
          {
            "name": "string",
            "component": "string"
          }
        ]
      }
    }
  }'

A successful response.

{
  "ruleId": "string"
}