UpdateNotifyPolicy - 更新通知策略

更新时间:
复制 MD 格式

更新通知策略

接口说明

通过 workspace + body(含 uuid 与 version)更新通知策略。version 为乐观锁版本号,须与后端当前记录一致,否则返回 OptimisticLockFailed;更新成功后返回最新策略详情。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

当前API暂无授权信息透出。

请求语法

PUT /api/eventbase/notify-policy/update HTTP/1.1

请求参数

名称

类型

必填

描述

示例值

workspace

string

是

工作空间 ID,用于隔离不同业务空间的通知策略资源。

default-cms-xxxx-cn-hangzhou

body NotifyPolicyConfig

否

请求 Body,通知策略完整配置对象 NotifyPolicyConfig。

同 Create,另 uuid 与 version 必填用于定位与并发控制。

返回参数

名称

类型

描述

示例值

object

Schema of Response

requestId

string

本次请求的唯一 ID,用于问题排查与工单定位。

70D52620-2609-1802-9788-6BC592C83F03

notifyPolicy NotifyPolicy

通知策略对象详情,包含策略 uuid、名称、描述、启用状态,及通知策略(分组合并、通知路由、渠道)、订阅(事件过滤、跨 workspace 路由、老产品事件订阅)、响应计划(升级、重复通知、自动恢复、行动集成)等子实体。

示例

正常返回示例

JSON格式

{
  "requestId": "70D52620-2609-1802-9788-6BC592C83F03",
  "notifyPolicy": {
    "uuid": "04779a183add4f2ca06ab440f16cc580",
    "name": "生产环境告警通知策略",
    "description": "生产环境告警通知策略",
    "enabled": true,
    "version": 1,
    "workspace": "default-cms-xxxx-cn-hangzhou",
    "userId": "1234567890123456",
    "createTime": "1710000000000",
    "updateTime": "1710000000000",
    "notifyStrategy": {
      "description": "生产环境告警通知策略",
      "ignoreRestoredNotification": true,
      "groupingSetting": {
        "groupingKeys": [
          "alertname"
        ],
        "periodMin": 0,
        "silenceSec": 0,
        "times": 0
      },
      "routes": [
        {
          "channels": [
            {
              "channelType": "WEBHOOK",
              "enabledSubChannels": [
                "EMAIL"
              ],
              "receivers": [
                "webhook-uuid-xxx"
              ]
            }
          ],
          "effectTimeRange": {
            "dayInWeek": [
              0
            ],
            "startTimeInMinute": 0,
            "endTimeInMinute": 1439,
            "timeZone": "Asia/Shanghai"
          },
          "filterSetting": {
            "expression": "1 and 2 or 3",
            "conditions": [
              {
                "op": "EQ",
                "field": "severity",
                "value": "CRITICAL"
              }
            ],
            "relation": "AND"
          },
          "digitalEmployeeName": "数字员工名",
          "enableRca": false
        }
      ],
      "customTemplateEntries": [
        {
          "templateUuid": "template-uuid-xxx"
        }
      ]
    },
    "subscription": {
      "filterSetting": {
        "expression": "1 and 2 or 3",
        "conditions": [
          {
            "op": "EQ",
            "field": "severity",
            "value": "CRITICAL"
          }
        ],
        "relation": "AND"
      },
      "workspaceFilterSetting": {
        "tagSelector": {
          "expression": "1 and 2 or 3",
          "conditions": [
            {
              "op": "EQ",
              "field": "severity",
              "value": "CRITICAL"
            }
          ],
          "relation": "AND"
        },
        "workspaceUuids": [
          "\"ws-abc123\""
        ]
      },
      "subscribeLegacyEvent": false
    },
    "responsePlan": {
      "escalationId": [
        "esc-uuid-xxx"
      ],
      "repeatNotifySetting": {
        "endIncidentState": "RECOVERED",
        "repeatInterval": 300
      },
      "autoRecoverSeconds": 300,
      "pushingSetting": {
        "alertActionIds": [
          "action-uuid-xxx"
        ],
        "restoreActionIds": [
          "action-uuid-yyy"
        ]
      }
    }
  }
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidParameterValue Illegal parameters. 参数错误。
400 Forbidden You are not authorized to operate the specified resource.
500 InternalUnknownError The request processing has failed due to some unknown error. 服务运行错误。
404 NotFound The specified resource is not found. 没有找到对应的资源。
409 OptimisticLockFailed The version is stale, please refresh and retry.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。