创建流转规则。

调试

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

请求语法

POST /routeRule/save HTTP/1.1
Content-Type:application/json

{
  "ruleName" : "String",
  "enableStatus" : "String",
  "relatedServiceId" : Long,
  "routeType" : "String",
  "incidentLevel" : "String",
  "assignObjectId" : Long,
  "assignObjectType" : "String",
  "effection" : "String",
  "timeWindow" : Long,
  "matchCount" : Integer,
  "timeWindowUnit" : "String",
  "routeChildRules" : [ {
    "monitorSourceId" : Long,
    "conditions" : [ {
      "key" : "String",
      "value" : "String",
      "operationSymbol" : "String"
    } ],
    "childConditionRelation" : Long
  } ],
  "notifyChannels" : [ "String" ],
  "clientToken" : "String",
  "childRuleRelation" : "String"
}

请求参数

表 1. 请求Body参数
参数名称 类型 是否必选 示例 说明
ruleName String 规则名称

流转规则名字

enableStatus String 启用禁用状态

启用状态

relatedServiceId Long 100

关联服务ID

routeType String INCIDENT

路由类型:INCIDENT 触发事件 ALERT 仅触发报警

incidentLevel String P1

事件级别 P1 P2 P3 P4

assignObjectId Long 65

事件分派对象ID(服务组ID 或用户ID)

assignObjectType String SERVICEGROUP

事件分派对象类型 SERVICEGROUP 服务组 USER 单个用户

effection String LOW

影响程度 LOW-一般 HIGH-严重

timeWindow Long 2

时间窗口

matchCount Integer 3

命中次数

timeWindowUnit String MINUTE

时间窗口单位

MINUTE 分钟

routeChildRules Array

子规则数组

monitorSourceId Long 1

监控源ID

conditions Array

匹配条件列表

key String payload.summary

匹配key

value String 123

匹配value

operationSymbol String equals

操作符

childConditionRelation Long 0

0-与,1-或

notifyChannels Array of String [SMS,PHONE]

通知渠道 SMS 短信 ,PHONE 语音,EMAIL 邮件,WEBHOOK 群通知

clientToken String C4BE3837-1A13-413B-A225-2C88188E8A43

幂等号

childRuleRelation String AND

子规则关系AND,OR

响应体语法

HTTP/1.1 200 OK
Content-Type:application/json

{
  "requestId" : "String",
  "data" : {
    "routeRuleId" : Long
  }
}

响应参数

表 2. 响应Body参数
参数名称 类型 示例 说明
requestId String 请求ID

请求

data Object

返回结果

routeRuleId Long 1000

规则ID

示例1

POST /routeRule/save HTTP/1.1
Host:gemp.cn-shanghai.aliyuncs.com
Content-Type:application/json

{
  "ruleName" : "规则名称",
  "enableStatus" : "启用禁用状态",
  "relatedServiceId" : 100,
  "routeType" : "INCIDENT",
  "incidentLevel" : "P1",
  "assignObjectId" : 65,
  "assignObjectType" : "SERVICEGROUP",
  "effection" : "LOW",
  "timeWindow" : 2,
  "matchCount" : 3,
  "timeWindowUnit" : "MINUTE",
  "routeChildRules" : [ {
    "monitorSourceId" : 1,
    "conditions" : [ {
      "key" : "payload.summary",
      "value" : "123",
      "operationSymbol" : "equals"
    } ],
    "childConditionRelation" : 0
  } ],
  "notifyChannels" : [ "[SMS,PHONE]" ],
  "clientToken" : "C4BE3837-1A13-413B-A225-2C88188E8A43",
  "childRuleRelation" : "AND"
}

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateRouteRuleResponse>
    <requestId>请求ID</requestId>
    <data>
        <routeRuleId>1000</routeRuleId>
    </data>
</CreateRouteRuleResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "requestId" : "请求ID",
  "data" : {
    "routeRuleId" : 1000
  }
}

错误码

HttpCode 错误码 错误信息 描述
400 AddRouteRuleFail Failed to add the rule. 添加流转规则失败
400 RouteRuleNameAlreadyExisted The rule name already exists. 流转规则名称已存在

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

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

开发者资源

  • SDK

    阿里云为您提供多种语言的SDK,帮助您快速通过API集成阿里云的产品和服务,推荐您使用SDK调用API,已免除您手动签名验证。

  • OpenAPI Explorer

    快速检索,可视化调试API,在线命令行工具,同步动态生成可执行的SDK代码示例。

  • 阿里云CLI

    阿里云资产管理和配置工具,可通过命令方式同时管理多个阿里云产品和服务,简单快捷,是您上云好帮手。