调用UpdateWebhook接口修改Webhook告警联系人信息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | UpdateWebhook |
系统规定参数。取值:UpdateWebhook。 |
ContactName | String | 是 | Webhook告警 |
自定义联系人名称。 |
Method | String | 是 | Post |
HTTP请求方法。
|
Url | String | 是 | https://oapi.dingtalk.com/robot/send?access_token=e1a049121ddbfce1ca963d115ef88cc7219583c4fb79fe6e398fbfb688****** |
Method的请求方法URL。 |
HttpParams | String | 否 | [{"name":"mike"}] |
HTTP请求参数。 |
HttpHeaders | String | 否 | [{"Content-Type":"application/json"}] |
HTTP请求头。 |
RegionId | String | 是 | cn-hangzhou |
地域ID。 |
ContactId | Long | 是 | 48716 |
Webhook告警联系人ID。 |
Body | String | 是 | { "告警名称":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}", "集群名称":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}", "应用名称":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}", "通知策略":"{{ .dispatchRuleName }}", "告警时间":"{{ .startTime }}", "告警内容":"{{ for .alerts }} {{ .annotations.message }} {{ end }}" } |
告警触发时发送的通知模板,当Method设置为Post时必填,可使用$content占位符输出通知内容,不可超过500个字符。 |
RecoverBody | String | 否 | { "告警名称":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}", "集群名称":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}", "应用名称":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}", "通知策略":"{{ .dispatchRuleName }}", "恢复时间":"{{ .endTime }}", "告警内容":"{{ for .alerts }} {{ .annotations.message }} {{ end }}" } |
告警恢复时发送的通知模板,当Method设置为Post时必填,可使用$content占位符输出通知内容,不可超过500个字符。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
IsSuccess | Boolean | true |
请求结果。
|
RequestId | String | 16AF921B-8187-489F-9913-43C808B4**** |
请求ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=UpdateWebhook
&ContactName=Webhook告警
&Method=Post
&Url=https://oapi.dingtalk.com/robot/send?access_token=e1a049121ddbfce1ca963d115ef88cc7219583c4fb79fe6e398fbfb688******
&HttpParams=[{"name":"mike"}]
&HttpHeaders=[{"Content-Type":"application/json"}]
&RegionId=cn-hangzhou
&ContactId=48716
&Body={ "告警名称":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}", "集群名称":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}", "应用名称":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}", "通知策略":"{{ .dispatchRuleName }}", "告警时间":"{{ .startTime }}", "告警内容":"{{ for .alerts }} {{ .annotations.message }} {{ end }}" }
&RecoverBody={ "告警名称":"{{ .commonLabels.alertname }}{{if .commonLabels.clustername }}", "集群名称":"{{ .commonLabels.clustername }} {{ end }}{{if eq "app" .commonLabels._aliyun_arms_involvedObject_kind }}", "应用名称":"{{ .commonLabels._aliyun_arms_involvedObject_name }} {{ end }}", "通知策略":"{{ .dispatchRuleName }}", "恢复时间":"{{ .endTime }}", "告警内容":"{{ for .alerts }} {{ .annotations.message }} {{ end }}" }
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<UpdateWebhookResponse>
<IsSuccess>true</IsSuccess>
<RequestId>16AF921B-8187-489F-9913-43C808B4****</RequestId>
</UpdateWebhookResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"IsSuccess" : true,
"RequestId" : "16AF921B-8187-489F-9913-43C808B4****"
}