List NotifyPolicies
接口说明
分页查询指定工作空间下的通知策略列表,支持按名称模糊过滤。返回结果为 NotifyPolicySummary 轻量视图列表。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求语法
GET /api/eventbase/notify-policies HTTP/1.1
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| workspace |
string |
是 |
工作空间 ID,用于隔离不同业务空间的通知策略资源。 |
default-cms-xxxx-cn-hangzhou |
| maxResults |
integer |
否 |
本次请求期望返回的最大记录条数。 |
10 |
| nextToken |
string |
否 |
分页凭证。首页不填,后续页传入上一页返回的 nextToken。 |
eyJjdXJzb3IiOjEwfQ== |
| name |
string |
否 |
按策略名称模糊过滤。 |
prod-alert |
| orderBy |
string |
否 |
排序字段,支持 createTime、updateTime、name 等。 |
createTime |
| orderDesc |
string |
否 |
是否倒序。true 为倒序,false 为正序。 |
true |
workspace 必填;maxResults 与 nextToken 用于分页;name 支持按策略名称模糊过滤。
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| requestId |
string |
本次请求的唯一 ID,用于问题排查与工单定位。 |
0B9377D9-C56B-5C2E-A8A4-A01D6CC3F4B8 |
| notifyPolicyList |
array |
通知策略列表。单条类型为 NotifyPolicySummary(轻量视图)。 |
[{"uuid":"np-12345678-1234-1234-1234-123456789012","name":"prod-alert","description":"生产环境告警策略","enabled":true,"version":1,"workspace":"default-cms-xxxx-cn-hangzhou","userId":"107640","createTime":"1711792800000","updateTime":"1711792800000"}] |
| NotifyPolicySummary |
通知策略摘要元素,类型为 NotifyPolicySummary。 |
||
| nextToken |
string |
下一页分页凭证,无更多数据时为空。 |
eyJjdXJzb3IiOjEwfQ== |
| maxResults |
integer |
本次请求所返回的最大记录条数。 |
10 |
| totalCount |
integer |
首页返回真实总数,后续页固定返回 -1。 |
100 |
notifyPolicyList 为策略摘要列表;totalCount 首页返回真实总数,后续页固定返回 -1。
示例
正常返回示例
JSON格式
{
"requestId": "0B9377D9-C56B-5C2E-A8A4-A01D6CC3F4B8",
"notifyPolicyList": [
{
"uuid": "",
"name": "",
"description": "",
"enabled": true,
"version": 0,
"workspace": "",
"userId": "",
"createTime": "",
"updateTime": "",
"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"
}
]
}
}
],
"nextToken": "eyJjdXJzb3IiOjEwfQ==",
"maxResults": 10,
"totalCount": 100
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | ParameterInvalid | The parameter is missing or invalid. %s | 参数缺失或者参数无效。 |
| 500 | InternalUnknownError | The request processing has failed due to some unknown error. | 服务运行错误。 |
| 403 | Forbidden | You are not authorized to operate the specified resource. | 没有权限,请使用RAM进行授权 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。