跳转至

修改



POST /api/v1/issue/notification_policy/{issue_notification_policy_uuid}/modify

概述

完整更新通知策略的通知范围、关联日程与升级配置。

调用前和使用步骤

修改要求提交完整目标name、日程UUID数组和extend,日程关系及extend会整体替换;省略notificationScheduleUUIDs清空日程,省略extend清空通知范围与规则。参数表中的notification_schedule_uuid是历史路径名称,此处填写的是URL实际issue_notification_policy_uuid对应的同一个策略UUID,不是日程UUID,也不是另一个Query参数。策略需要在控制台关联到目标频道,并关联有效通知日程;实际接收人由日程的时区、当日时段、有效期、轮换和通知目标决定。保存策略本身不会立即发送测试通知。升级由站点定时任务检查,不是精确倒计时;只检查触发配置创建或更新后新建的Issue。日程当时无有效目标也可能记一次触发,不能把触发次数当作送达次数;请同时核对通知目标和实际消息。策略主体、关联关系和升级触发配置分步保存。失败或超时后先读取详情确认已有变更,再决定是否重试。当前版本仅在已有策略新增加noManager/processTimeout/openProcessTimeout时间型规则、且该类型此前不存在触发配置时,触发配置保存可能失败;策略主体可能已保存。更新已存在同类型配置与eventStorm新增不属于这一条件,失败后须读取详情并核对实际触发效果。

路由参数

参数名 类型 必选 说明
notification_schedule_uuid string Y 路径中的通知策略UUID;不是日程UUID,不额外传Query。
例子: inpy_example
获取或填写方式: 从通知策略列表取得策略UUID。此名称仅是历史声明,对应实际URL的issue_notification_policy_uuid。

请求头

参数名 类型 必选 说明
DF-API-KEY string Y 工作空间的 OpenAPI 鉴权凭据。
例子: <DF-API-KEY>
获取或填写方式: 从目标工作空间的 API Key 管理获取有该操作权限的 OpenAPI Key。

Body 请求参数

参数名 类型 必选 说明
notificationScheduleUUIDs[*] string 单个通知日程UUID。不能使用通知对象UUID替代。
例子: nsche_example
获取或填写方式: 从通知日程列表复制单个日程UUID,可用通知日程详情确认配置及目标。
extend.notifyTypes[*] string 单个触发类型。openProcessTimeout也由issueUpgrade.processTimeout启用,不另传issueUpgrade.openProcessTimeout。
例子: issueUpgrade.eventStorm
获取或填写方式: 按触发意图选取一个上述事件类型;事件类型本身不指定接收人。
extend.upgradeCfg.noManager json Issue创建时没有有效负责人并进入无负责人候选,状态为Open/Working/Pending时,从Issue创建起等待;已有Issue仅移除负责人不保证重新进入候选。填写正整数秒且为60的倍数。省略或空对象不启用该规则。
例子: {"duration": 600, "notifyType": "once"}
获取或填写方式: 在extend.notifyTypes中包含issueUpgrade.noManager后,根据业务期望填写。
extend.upgradeCfg.noManager.duration integer 启用时必填正整数秒,须为60的倍数,最大31622400秒;省略或0不创建该规则。
例子: 600
获取或填写方式: 根据业务等待时长换算为秒,例如600为10分钟。
extend.upgradeCfg.noManager.notifyType string 通知方式,once或cycle,省略默认once。
例子: once
获取或填写方式: 只通知一次填once;需要重复检查发送时填cycle。
extend.upgradeCfg.noManager.cycleDuration integer cycle模式必填的循环间隔,单位秒;不是每次都增加duration,实际还受定时任务和日程有效性影响。
例子: 600
获取或填写方式: cycle模式选择正整数秒间隔,如600为10分钟;once模式省略。
extend.upgradeCfg.noManager.cycleTimes integer cycle模式必填,最多触发次数,包含首次。校验范围1至30,实际记次不等于成功送达次数。
例子: 3
获取或填写方式: cycle模式填写1至30的整数;once模式省略。
extend.upgradeCfg.processTimeout json Issue处于Open/Working的持续未完成时间。首次从创建计时;从Pending/Resolved/Closed重新进入处理状态时,从重新进入后的状态记录计时。省略或空对象不启用该规则。
例子: {"duration": 1800, "notifyType": "cycle", "cycleDuration": 600, "cycleTimes": 3}
获取或填写方式: 在extend.notifyTypes中包含issueUpgrade.processTimeout后,根据业务期望填写。
extend.upgradeCfg.processTimeout.duration integer 启用时必填正整数秒,须为60的倍数,最大31622400秒;省略或0不创建该规则。
例子: 1800
获取或填写方式: 根据业务等待时长换算为秒,例如600为10分钟。
extend.upgradeCfg.processTimeout.notifyType string 通知方式,once或cycle,省略默认once。
例子: cycle
获取或填写方式: 只通知一次填once;需要重复检查发送时填cycle。
extend.upgradeCfg.processTimeout.cycleDuration integer cycle模式必填的循环间隔,单位秒;不是每次都增加duration,实际还受定时任务和日程有效性影响。
例子: 600
获取或填写方式: cycle模式选择正整数秒间隔,如600为10分钟;once模式省略。
extend.upgradeCfg.processTimeout.cycleTimes integer cycle模式必填,最多触发次数,包含首次。校验范围1至30,实际记次不等于成功送达次数。
例子: 3
获取或填写方式: cycle模式填写1至30的整数;once模式省略。
extend.upgradeCfg.openProcessTimeout json 仅Issue保持Open时生效,从最后一次状态变更时间计时;没有状态记录则从创建时间计时。省略或空对象不启用该规则。
例子: {"duration": 900, "notifyType": "once"}
获取或填写方式: 在extend.notifyTypes中包含issueUpgrade.processTimeout后,根据业务期望填写。
extend.upgradeCfg.openProcessTimeout.duration integer 启用时必填正整数秒,须为60的倍数,最大31622400秒;省略或0不创建该规则。
例子: 900
获取或填写方式: 根据业务等待时长换算为秒,例如600为10分钟。
extend.upgradeCfg.openProcessTimeout.notifyType string 通知方式,once或cycle,省略默认once。
例子: once
获取或填写方式: 只通知一次填once;需要重复检查发送时填cycle。
extend.upgradeCfg.openProcessTimeout.cycleDuration integer cycle模式必填的循环间隔,单位秒;不是每次都增加duration,实际还受定时任务和日程有效性影响。
例子: 600
获取或填写方式: cycle模式选择正整数秒间隔,如600为10分钟;once模式省略。
extend.upgradeCfg.openProcessTimeout.cycleTimes integer cycle模式必填,最多触发次数,包含首次。校验范围1至30,实际记次不等于成功送达次数。
例子: 3
获取或填写方式: cycle模式填写1至30的整数;once模式省略。
extend.upgradeCfg.eventStorm json Issue记录的eventCount严格大于exceedTimes后触发;不按Open/Working状态限定,已完成Issue也可能满足数量条件。省略或空对象不启用该规则。
例子: {"exceedTimes": 60, "notifyType": "once"}
获取或填写方式: 在extend.notifyTypes中包含issueUpgrade.eventStorm后,根据业务期望填写。
extend.upgradeCfg.eventStorm.exceedTimes integer 事件数量阈值,不是时间;启用时必填正整数,不超过31622400。
例子: 60
获取或填写方式: 按可接受的关联事件数量设正整数阈值,例如60表示eventCount超过60才触发。
extend.upgradeCfg.eventStorm.notifyType string 通知方式,once或cycle,省略默认once。
例子: once
获取或填写方式: 只通知一次填once;需要重复检查发送时填cycle。
extend.upgradeCfg.eventStorm.cycleDuration integer cycle模式必填的循环间隔,单位秒;不是每次都增加duration,实际还受定时任务和日程有效性影响。
例子: 600
获取或填写方式: cycle模式选择正整数秒间隔,如600为10分钟;once模式省略。
extend.upgradeCfg.eventStorm.cycleTimes integer cycle模式必填,最多触发次数,包含首次。校验范围1至30,实际记次不等于成功送达次数。
例子: 3
获取或填写方式: cycle模式填写1至30的整数;once模式省略。
name string Y 必填非空策略名,最长256字符;修改时也必须提交。
允许 null: False
最大长度: 256
允许空字符串: False
例子: 生产异常通知
获取或填写方式: 从通知策略列表检查现有策略名称,选择当前空间内未使用的名称。
notificationScheduleUUIDs array 完整目标日程UUID数组,省略或[]清空所有日程关联。
允许 null: False
例子: ["nsche_example"]
获取或填写方式: 从通知日程列表的content.data[].uuid取得同空间的通知日程;一个策略可关联多个日程。
extend json 完整目标通知配置;省略或{}清空保存的通知范围和升级规则。
允许 null: False
例子: {"notifyTypes": ["issue.add", "issue.modify", "issueReply.add", "issueUpgrade.noManager", "issueUpgrade.processTimeout", "issueUpgrade.eventStorm"], "upgradeCfg": {"noManager": {"duration": 600, "notifyType": "once"}, "processTimeout": {"duration": 1800, "notifyType": "cycle", "cycleDuration": 600, "cycleTimes": 3}, "openProcessTimeout": {"duration": 900, "notifyType": "once"}, "eventStorm": {"exceedTimes": 60, "notifyType": "once"}}}
获取或填写方式: 根据需要接收的Issue动作和升级规则填写;无内容可传{}。
extend.notifyTypes array 通知触发类型数组:issue.add=Issue创建通知;issue.modify=Issue修改通知;issueReply.add=回复创建通知;issueReply.modify=回复修改通知;issueReply.delete=回复删除通知;issueUpgrade.noManager=没有负责人的升级通知;issueUpgrade.processTimeout=处理超时升级,控制processTimeout和openProcessTimeout两项;issueUpgrade.eventStorm=关联事件数量严格超过阈值后的事件风暴通知;dailySummary=按站点汇总任务发送的每日汇总。
允许 null: False
例子: ["issue.add", "issue.modify", "issueReply.add", "issueUpgrade.noManager", "issueUpgrade.processTimeout", "issueUpgrade.eventStorm"]
获取或填写方式: 从下列实际支持的事件类型选择,需要哪类就包含相应字符串;省略或[]不启用这些动作。
extend.upgradeCfg json 四类升级规则对象,可分别配置;无升级规则时省略或{}。
允许 null: False
例子: {"noManager": {"duration": 600, "notifyType": "once"}, "processTimeout": {"duration": 1800, "notifyType": "cycle", "cycleDuration": 600, "cycleTimes": 3}, "openProcessTimeout": {"duration": 900, "notifyType": "once"}, "eventStorm": {"exceedTimes": 60, "notifyType": "once"}}
获取或填写方式: 先在notifyTypes启用对应升级类型,再填写其规则;只填规则而不启用类型不会创建有效升级触发器。

参数补充说明

noManager为无负责人等待,processTimeout为Open/Working连续处理超时,openProcessTimeout仅Open超时;后两项同由issueUpgrade.processTimeout启用。eventStorm用关联事件数阈值而非等待秒数。循环规则须同时提供cycleDuration和cycleTimes,缺字段可能只保存配置但不建立可生效规则。嵌套字段未严格逐项校验,错误类型也可能返回通用内部错误。

请求例子

curl --request POST 'https://openapi.guance.com/api/v1/issue/notification_policy/inpy_example/modify' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"name":"生产异常通知","notificationScheduleUUIDs":["nsche_example"],"extend":{"notifyTypes":["issue.add","issue.modify","issueReply.add","issueUpgrade.noManager","issueUpgrade.processTimeout","issueUpgrade.eventStorm"],"upgradeCfg":{"noManager":{"duration":600,"notifyType":"once"},"processTimeout":{"duration":1800,"notifyType":"cycle","cycleDuration":600,"cycleTimes":3},"openProcessTimeout":{"duration":900,"notifyType":"once"},"eventStorm":{"exceedTimes":60,"notifyType":"once"}}}}'

响应

HTTP 200,application/json。下方示例展示可直接读取的主要字段。

字段 类型 说明
content.id integer 已存在配置的数据库编号;后续接口定位使用uuid。
content.uuid string 通知策略UUID,inpy_开头。
content.workspaceUUID string 所属工作空间UUID。
content.name string 策略名称。
content.status integer 记录状态,0启用,2禁用,3删除;列表包含未删除的启用和禁用策略。
content.creator string 创建调用身份。
content.updator string 最近更新身份,未更新为空字符串。
content.createAt integer 创建时间,Unix秒。
content.updateAt integer 更新时间,Unix秒,未更新为-1。
content.deleteAt integer 删除时间,Unix秒,未删除为-1。
content.extend object 保存的通知范围与升级规则,可为{}。
content.extend.notifyTypes array<string> 启用的动作类型。
content.extend.notifyTypes[] string 单个动作类型,具体作用见参数表。
content.extend.upgradeCfg object 按触发类型保存的规则。
content.extend.upgradeCfg.noManager object Issue创建时没有有效负责人并进入无负责人候选,状态为Open/Working/Pending时,从Issue创建起等待;已有Issue仅移除负责人不保证重新进入候选。填写正整数秒且为60的倍数。启用类型为issueUpgrade.noManager,未配置时省略。
content.extend.upgradeCfg.noManager.duration integer 首次等待秒数。
content.extend.upgradeCfg.noManager.notifyType string once或cycle;未保存该值时按once。
content.extend.upgradeCfg.noManager.cycleDuration integer 循环间隔,单位秒,cycle模式使用。
content.extend.upgradeCfg.noManager.cycleTimes integer 循环触发总次数上限,1至30,包含首次。
content.extend.upgradeCfg.processTimeout object Issue处于Open/Working的持续未完成时间。首次从创建计时;从Pending/Resolved/Closed重新进入处理状态时,从重新进入后的状态记录计时。启用类型为issueUpgrade.processTimeout,未配置时省略。
content.extend.upgradeCfg.processTimeout.duration integer 首次等待秒数。
content.extend.upgradeCfg.processTimeout.notifyType string once或cycle;未保存该值时按once。
content.extend.upgradeCfg.processTimeout.cycleDuration integer 循环间隔,单位秒,cycle模式使用。
content.extend.upgradeCfg.processTimeout.cycleTimes integer 循环触发总次数上限,1至30,包含首次。
content.extend.upgradeCfg.openProcessTimeout object 仅Issue保持Open时生效,从最后一次状态变更时间计时;没有状态记录则从创建时间计时。启用类型为issueUpgrade.processTimeout,未配置时省略。
content.extend.upgradeCfg.openProcessTimeout.duration integer 首次等待秒数。
content.extend.upgradeCfg.openProcessTimeout.notifyType string once或cycle;未保存该值时按once。
content.extend.upgradeCfg.openProcessTimeout.cycleDuration integer 循环间隔,单位秒,cycle模式使用。
content.extend.upgradeCfg.openProcessTimeout.cycleTimes integer 循环触发总次数上限,1至30,包含首次。
content.extend.upgradeCfg.eventStorm object Issue记录的eventCount严格大于exceedTimes后触发;不按Open/Working状态限定,已完成Issue也可能满足数量条件。启用类型为issueUpgrade.eventStorm,未配置时省略。
content.extend.upgradeCfg.eventStorm.exceedTimes integer 数量阈值,eventCount严格超过才触发。
content.extend.upgradeCfg.eventStorm.notifyType string once或cycle;未保存该值时按once。
content.extend.upgradeCfg.eventStorm.cycleDuration integer 循环间隔,单位秒,cycle模式使用。
content.extend.upgradeCfg.eventStorm.cycleTimes integer 循环触发总次数上限,1至30,包含首次。
content.extend.其他字段 JSON 来源保存的其他扩展字段,不代表都能控制通知行为。
content.notificationScheduleUUIDs array<string> 本次全量替换后的日程UUID数组;请求省略按[]清空关联,不是保持原值。
content.notificationScheduleUUIDs[] string 日程UUID。
content.declaration object 或 null 工作空间公共声明。
{
  "code": 200,
  "content": {
    "id": 42,
    "uuid": "inpy_example",
    "workspaceUUID": "wksp_example",
    "name": "生产异常通知",
    "extend": {
      "notifyTypes": [
        "issue.add",
        "issue.modify",
        "issueReply.add",
        "issueUpgrade.noManager",
        "issueUpgrade.processTimeout",
        "issueUpgrade.eventStorm"
      ],
      "upgradeCfg": {
        "noManager": {
          "duration": 600,
          "notifyType": "once"
        },
        "processTimeout": {
          "duration": 1800,
          "notifyType": "cycle",
          "cycleDuration": 600,
          "cycleTimes": 3
        },
        "openProcessTimeout": {
          "duration": 900,
          "notifyType": "once"
        },
        "eventStorm": {
          "exceedTimes": 60,
          "notifyType": "once"
        }
      }
    },
    "status": 0,
    "creator": "wsak_example",
    "updator": "wsak_example",
    "createAt": 1785430800,
    "updateAt": 1785430860,
    "deleteAt": -1,
    "notificationScheduleUUIDs": [
      "nsche_example"
    ],
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

错误响应

鉴权、限流和公共请求错误参见公共错误定义。

HTTP 状态 errorCode 触发条件 消息或响应说明 处理方式
404 ft.ObjectNotExists 策略不存在、已删除或不属于当前API Key工作空间 指定对象不存在 从通知策略列表重新取得本空间UUID。
406 ft.ParameterValidationFailed 请求字段缺失,或字段值违反声明的校验条件 参数解析失败 核对参数位置、字段名、类型和取值。
400 ft.RequestJsonFormatError 请求 JSON 语法无效 请求 JSON 格式错误 按 content.reason、line、column 修正 JSON。
400 ft.JsonFormatError JSON顶层不是对象 部分 json 文件格式错误 提交单个JSON对象。
400 ft.PolicySameNameExists 当前空间存在同名未删除策略,包括禁用策略 已存在同名通知策略 选择未占用名称;超时后先确认是否已保存。
400 ft.InvalidFieldValue notifyType不是once/cycle,或cycleTimes不在1至30 字段 {} 值: {} 无效 按规则填写notifyType及次数;嵌套对象请使用正确类型。
400 ft.UpgradeTimeTooLarge 任一时间型duration大于31622400秒 升级时间配置过大, 请设置合理的升级触发时间 缩短等待时间,最大31622400秒。
400 ft.InvalidUpgradeTimeDuration 时间型duration不是60秒的整数倍 升级时间配置, 需要为 60(s) 正整数倍 使用正整数分钟乘60后的秒数。
400 ft.exceedTimesTooLarge eventStorm.exceedTimes大于31622400 关联事件触发次数过大, 请设置合理的触发次数 使用不超过31622400的正整数事件数量阈值。
500 ft.InternalServerError 策略关系保存、升级触发配置更新或审计等未处理异常;主体或关系可能已经提交,原策略缺少时间触发配置时也可能在后续处理失败 内部错误 按原策略UUID读取name、extend,并从relNotificationScheduleInfos[].uuid核对日程关联,再核对实际升级触发状态;省略日程数组会清空。不要按新增重建同名策略,保留traceId定位尚未完成部分。

文档评价

文档内容是否对您有帮助?