ListNotifyPolicies
Lists notification policies.
Operation description
Queries notification policies in a specified workspace by using paging and supports fuzzy filtering by name. The response contains a list of NotifyPolicySummary lightweight views.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cms:ListNotifyPolicies |
list |
*Workspace
|
None | None |
Request syntax
GET /api/eventbase/notify-policies HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| workspace |
string |
Yes |
The workspace ID, which is used to isolate notification policy resources across different business workspaces. |
default-cms-xxxx-cn-hangzhou |
| maxResults |
integer |
No |
The maximum number of entries to return for this request. |
10 |
| nextToken |
string |
No |
The pagination token. Leave this parameter empty for the first request. For subsequent requests, pass the nextToken value returned from the previous response. |
eyJjdXJzb3IiOjEwfQ== |
| name |
string |
No |
The keyword for fuzzy filtering by policy name. |
prod-alert |
| orderBy |
string |
No |
The field by which to sort the results. Valid values: createTime, updateTime, and name. |
createTime |
| orderDesc |
string |
No |
Specifies whether to sort the results in descending order. A value of true indicates descending order, and a value of false indicates ascending order. |
true |
The workspace parameter is required. The maxResults and nextToken parameters are used for pagination. The name parameter supports fuzzy filtering by policy name.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| requestId |
string |
The unique ID of the request, which is used for troubleshooting and ticket tracking. |
0B9377D9-C56B-5C2E-A8A4-A01D6CC3F4B8 |
| notifyPolicyList |
array |
The list of notification policies. Each item is of the NotifyPolicySummary type, which represents a lightweight view. |
[{"uuid":"np-12345678-1234-1234-1234-123456789012","name":"prod-alert","description":"Production environment alert policy","enabled":true,"version":1,"workspace":"default-cms-xxxx-cn-hangzhou","userId":"107640","createTime":"1711792800000","updateTime":"1711792800000"}] |
| NotifyPolicySummary |
The notification policy summary element, which is of the NotifyPolicySummary type. |
||
| nextToken |
string |
The pagination token for the next page. This parameter is empty if no more data is available. |
eyJjdXJzb3IiOjEwfQ== |
| maxResults |
integer |
The maximum number of entries returned for this request. |
10 |
| totalCount |
integer |
The total number of entries. The actual total count is returned for the first page, and -1 is returned for subsequent pages. |
100 |
The notifyPolicyList parameter is a list of policy summaries. The totalCount parameter returns the actual total count for the first page and -1 for subsequent pages.
Examples
Success response
JSON format
{
"requestId": "0B9377D9-C56B-5C2E-A8A4-A01D6CC3F4B8",
"notifyPolicyList": [
{
"uuid": "ns-uuid-001",
"name": "Sample notification policy",
"description": "A notification policy for testing",
"enabled": true,
"version": 1,
"workspace": "default",
"userId": "1234567890",
"createTime": "1700000000000",
"updateTime": "1700000000000",
"notifyStrategy": {
"description": "Production environment alert notification policy",
"ignoreRestoredNotification": true,
"groupingSetting": {
"groupingKeys": [
"alertname"
],
"periodMin": 0,
"silenceSec": 0,
"times": 0
},
"routes": [
{
"channels": [
{
"channelType": "DING",
"enabledSubChannels": [
"EMAIL"
],
"receivers": [
"webhook-uuid-xxx"
]
}
],
"effectTimeRange": {
"dayInWeek": [
0
],
"startTimeInMinute": 0,
"endTimeInMinute": 1439,
"timeZone": "Asia/Shanghai"
},
"filterSetting": {
"conditions": [
{
"field": "labels.alertname\t",
"op": "EQ",
"value": "CRITICAL"
}
],
"expression": "1 and 2 or 3",
"relation": "AND"
},
"digitalEmployeeName": "Digital employee name",
"enableRca": false
}
],
"customTemplateEntries": [
{
"templateUuid": "template-uuid-xxx"
}
]
}
}
],
"nextToken": "eyJjdXJzb3IiOjEwfQ==",
"maxResults": 10,
"totalCount": 100
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | ParameterInvalid | The parameter is missing or invalid. %s | The parameter is missing or invalid. |
| 500 | InternalUnknownError | The request processing has failed due to some unknown error. | A service runtime error occurred. |
| 403 | Forbidden | You are not authorized to operate the specified resource. | No permission, please use RAM to authorize |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.