Update an alert policy
PUT /api/alert/policies/{alert_policy_id}
PUT /api/alert/policies/{alert_policy_id}Interactive request editor loads with JavaScript.
In: header
Path Parameters
Alert policy ID.
Request Body
application/json
Response Body
application/json
application/json
curl -X PUT "$API_BASE_URL/api/alert/policies/string" \ -H "Content-Type: application/json" \ -d '{ "name": "500 status alert", "trigger_logical_operator": "All", "trigger_conditions": [ { "event": "number_of_status_code", "scope": {}, "event_config": { "duration": 60, "unit": "second", "http_status_code": "500" }, "operator": "larger_than", "value": 5 } ] }'Successful operation.
{
"value": {}
}Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.
{
"value": {},
"error_msg": "error message"
}Complete operation details and schema variants
PUT /api/alert/policies/{alert_policy_id}
Update an alert policy
Replace the full configuration of an alert policy with the provided payload. Use this operation when you want to update all policy fields in a single request.
Required IAM Permission: Action gateway:UpdateAlertPolicy, Resource arn:api7:gateway:alert/%s
Parameters
alert_policy_id(path, string, required): Alert policy ID.
Request body
Content type: application/json
name(string, required): The alert policy name.desc(string, optional): The alert policy description.labels(object, optional): Key-value pairs of labels.enable(boolean, optional): If true, enable the alert policy.check_interval(integer, optional): The check interval for the alert policy. The unit is second.severity(string, optional): The alert severity level.trigger_logical_operator(string, required): The logical relationship between multiple triggers.trigger_conditions(array, required): The alert trigger conditions.- oneOf variant 1: Status Code
trigger_conditions[].event(string, required): The event of the trigger.trigger_conditions[].scope(object, required): The scope of the trigger.trigger_conditions[].scope.gateway_group_ids(array, optional): An array of gateway group IDs.trigger_conditions[].scope.gateway_group_labels(object, optional): Key-value pairs of gateway group labels.trigger_conditions[].scope.service_id(string, optional): Published service ID to scope the alert to.trigger_conditions[].scope.route_id(string, optional): Route ID to scope the alert to.- oneOf variant 1: Gateway Group IDs
- oneOf variant 2: Gateway Group Labels
trigger_conditions[].event_config(object, required): Alert event configurations.trigger_conditions[].event_config.duration(integer, required): The duration time.trigger_conditions[].event_config.unit(string, required): The duration unit.trigger_conditions[].event_config.http_status_code(string, required): The HTTP status code.trigger_conditions[].operator(string, required): The operator for the trigger condition.trigger_conditions[].value(integer, required): The numeric threshold to trigger to alert.- oneOf variant 2: Certificate Expiry
trigger_conditions[].event(string, required): The event of the trigger.trigger_conditions[].scope(object, required): The scope of the trigger.trigger_conditions[].scope.gateway_group_ids(array, optional): An array of gateway group IDs.trigger_conditions[].scope.gateway_group_labels(object, optional): Key-value pairs of gateway group labels.- oneOf variant 1: Gateway Group IDs
- oneOf variant 2: Gateway Group Labels
trigger_conditions[].operator(string, required): The operator for the trigger condition.trigger_conditions[].value(integer, required): The numeric threshold to trigger to alert.trigger_conditions[].value_unit(string, required): The duration unit.- oneOf variant 3: License Expiry
trigger_conditions[].event(string, required): The event of the trigger.trigger_conditions[].operator(string, required): The operator for the trigger condition.trigger_conditions[].value(integer, required): The numeric threshold to trigger to alert.trigger_conditions[].value_unit(string, required): The duration unit.- oneOf variant 4: Gateway Instance Offline
trigger_conditions[].event(string, required): The event of trigger.trigger_conditions[].scope(object, required): The scope of the trigger.trigger_conditions[].scope.gateway_group_ids(array, optional): An array of gateway group IDs.trigger_conditions[].scope.gateway_group_labels(object, optional): Key-value pairs of gateway group labels.- oneOf variant 1: Gateway Group IDs
- oneOf variant 2: Gateway Group Labels
trigger_conditions[].operator(string, required): The operator for the trigger condition.trigger_conditions[].value(integer, required): The numeric threshold to trigger to alert.trigger_conditions[].value_unit(string, required): The duration unit.- oneOf variant 5: Data Plane Cores Exceeded
trigger_conditions[].event(string, optional): The event of trigger.- oneOf variant 6: Numbers of Healthy Gateway Instances
trigger_conditions[].event(string, required): The event of trigger.trigger_conditions[].scope(object, required): The scope of the trigger.trigger_conditions[].scope.gateway_group_ids(array, optional): An array of gateway group IDs.trigger_conditions[].scope.gateway_group_labels(object, optional): Key-value pairs of gateway group labels.- oneOf variant 1: Gateway Group IDs
- oneOf variant 2: Gateway Group Labels
trigger_conditions[].operator(string, required): The operator for the trigger condition.trigger_conditions[].value(integer, required): The numeric threshold to trigger to alert.- oneOf variant 7: Shared Dict Free Space Percentage
trigger_conditions[].event(string, required): The event of trigger for shared memory (shared dictionary) free space monitoring in percentage. Applies to all shared dictionaries; the alert reports which one is affected.trigger_conditions[].scope(object, required): The scope of the trigger.trigger_conditions[].scope.gateway_group_ids(array, optional): An array of gateway group IDs.trigger_conditions[].scope.gateway_group_labels(object, optional): Key-value pairs of gateway group labels.- oneOf variant 1: Gateway Group IDs
- oneOf variant 2: Gateway Group Labels
trigger_conditions[].operator(string, required): The operator for the trigger condition.trigger_conditions[].value(integer, required): The free space percentage threshold to trigger the alert.notifications(array, optional): The alert notifications.- oneOf variant 1: Email
notifications[].type(string, required): The notification type.notifications[].contact_point_ids(array, optional): An array of contact point IDs.notifications[].subject(string, required): The email subject.notifications[].content(string, required): The email content.- oneOf variant 2: Webhook
notifications[].type(string, required): The notification type.notifications[].contact_point_ids(array, optional): An array of contact point IDs.notifications[].alert_message(string, required): The alert message.debug_sessions(array, optional): Debug session configurations to create automatically when the alert is triggered.debug_sessions[].max_samples(integer, required): The maximum number of trace samples to collect.debug_sessions[].duration_secs(integer, required): The duration in seconds for the debug session.debug_sessions[].sampling_rule(array,null, optional): Sampling rules in lua-resty-expr format.
Responses
200: Successful operation.value(object, optional): The specific resource.400: Bad Request — The request was malformed or contained invalid parameters. Check the error_msg field for details.value(object, optional): The specific resource.error_msg(string, optional): The error message.
cURL
curl -X PUT '$API_BASE_URL/api/alert/policies/{alert_policy_id}'