API DocsRESTRule service

BatchUpdateRules

Updates existing rules or creates rules that do not exist.

PUT
/api/v1/rules:batchUpdate

Request Body

application/jsonRequired

rules
Required
rules are limited 1000 rules at a time

validateOnlyboolean

If validate_only is true, the request will only validate the request and not save the rules.

overrideExpressionValidation
Required
boolean

If override_expression_validation is true, the request will save the rules even if the expressions are invalid. This can be useful for multi-asset rules where an invalid expression for one asset should not prevent the rule from being saved.

curl -X PUT "<API_URL>/api/v1/rules:batchUpdate" \
  -H "Authorization: Bearer <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "rules": [
      {
        "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"
            }
          ]
        }
      }
    ],
    "validateOnly": true,
    "overrideExpressionValidation": true
  }'

A successful response.

{
  "success": true,
  "rulesCreatedCount": 0,
  "rulesUpdatedCount": 0,
  "validateOnly": true,
  "validationResults": [
    {
      "ruleId": "string",
      "clientKey": "string",
      "assetExpressionValidationResults": [
        {
          "assetId": "string",
          "assetName": "string",
          "assetTagId": "string",
          "error": "string"
        }
      ],
      "error": "string"
    }
  ]
}