建立或修改Webhook警示連絡人。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| WebhookId |
integer |
否 |
Webhook 警示連絡人 ID。
|
123 |
| WebhookName |
string |
是 |
Webhook 警示連絡人名稱。 |
Webhook警示 |
| Method |
string |
是 |
HTTP 要求方法。
|
Post |
| Url |
string |
是 |
Method 的要求方法 URL。 |
https://oapi.dingtalk.com/robot/send?access_token=e1a049121****** |
| BizHeaders |
string |
否 |
HTTP 要求頭。 |
[{"Content-Type":"application/json;charset=utf-8"}] |
| BizParams |
string |
否 |
HTTP 要求參數。 |
[{"content":"mike"}] |
| Body |
string |
否 |
警示觸發時發送的通知模板,當 Method 設定為 Post 時必填,可使用 |
{ "警示名稱":"{{ .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 |
string |
否 |
警示恢複時發送的通知模板,當 Method 設定為 Post 時必填,可使用 |
{ "警示名稱":"{{ .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 }}" } |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
Schema of Response |
||
| RequestId |
string |
請求 ID。 |
16AF921B-8187-489F-9913-43C808B4**** |
| WebhookContact |
object |
返回的 WebhookContact 對象。 |
|
| WebhookId |
number |
Webhook 警示連絡人 ID。 |
123 |
| WebhookName |
string |
Webhook 警示連絡人名稱。 |
Webhook警示 |
| Webhook |
object |
返回的 Webhook 對象。 |
|
| Method |
string |
HTTP 要求方法。
|
Post |
| Url |
string |
要求方法 URL。 |
https://oapi.dingtalk.com/robot/send?access_token=e1a049121****** |
| BizHeaders |
string |
HTTP 要求頭。 |
[{"Content-Type":"application/json;charset=utf-8"}] |
| BizParams |
string |
HTTP 要求參數。 |
[{"content":"mike"}] |
| 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 }}" } |
| 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 }}" } |
樣本
正常返回樣本
JSON格式
{
"RequestId": "16AF921B-8187-489F-9913-43C808B4****",
"WebhookContact": {
"WebhookId": 123,
"WebhookName": "Webhook警示",
"Webhook": {
"Method": "Post",
"Url": "https://oapi.dingtalk.com/robot/send?access_token=e1a049121******",
"BizHeaders": "[{\"Content-Type\":\"application/json;charset=utf-8\"}]",
"BizParams": "[{\"content\":\"mike\"}]",
"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 }}\" }"
}
}
}
錯誤碼
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。