Batch Disable/Enable¶
POST /api/v1/slo/batch_set_disable
Overview¶
Batch set SLO enable/disable status.
Prerequisites and Usage Steps¶
The current API Key requires monitor.sloCfgManage; metric-type saves also require query permission for the target metric namespace. SLO management permission alone is not sufficient to pass this pre-check. This operation only applies to the workspace to which the Key belongs. The SLO UUID in the path comes from content.data[].uuid in Get SLO List (usually with a monitor_ prefix), not the Rule UUID of the associated Monitor or metricQueryInfo.sloId.
Enabling/disabling simultaneously adjusts the SLO, associated detection/computation components, and remote scheduling. It returns only an array of SLO names whose status actually changed this time, not all requested UUIDs or a per-item success mapping. If there is no match, the target is already in the specified status, or only non-SLO items are included, the result can all be []; there is no per-item not-found error.
Disabling a metric-type SLO records the stop time. When re-enabling from disabled, validAfter is reset, and statistics after recovery should not be directly merged into the old effective interval. Pausing a Monitor-type SLO does not delete the original SLI Monitor; this operation is not responsible for pausing the original Monitor itself. Creation, modification, and enable/disable are committed at the end of the local transaction. On failure, an attempt is made to restore remote scheduling and cache; remote compensation may also fail, so you cannot conclude that all systems are unchanged based on an HTTP failure. After a network timeout/500, first use Get SLO Details to verify the configuration and status; if necessary, ask the administrator to verify scheduling before retrying. A successful save does not mean detection results have been generated; wait for the detection frequency and check actual data.
Request Headers¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| DF-API-KEY | string | Y | OpenAPI authentication credential for the workspace. Example: <DF-API-KEY>How to obtain or fill: Obtain an OpenAPI Key with this operation permission from API Key management in the target workspace. |
Body Request Parameters¶
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| sloUUIDs[*] | string | A single SLO UUID string. Example: monitor_exampleHow to obtain or fill: Same as the array source. |
|
| isDisable | boolean | Y | Required boolean; true disables, false enables; does not accept strings or null. Disabling does not delete the configuration. Allow null: False Example: trueHow to obtain or fill: Select based on whether to pause SLO detection. |
| sloUUIDs | array | Y | Required array; [] means no operation; only modifies items in the same workspace that are not deleted SLOs and whose status needs to change; other items are silently skipped, with no per-item error.Allow null: False Example: ["monitor_example"]How to obtain or fill: Obtain from content.data[].uuid in the current workspace's SLO list. |
Request Example¶
curl --request POST 'https://openapi.guance.com/api/v1/slo/batch_set_disable' \
-H 'DF-API-KEY: <DF-API-KEY>' \
-H 'Content-Type: application/json' \
--data-raw '{"isDisable":true,"sloUUIDs":["monitor_example"]}'
Response¶
HTTP 200, application/json. The example below shows the main fields that can be read directly.
| Field | Type | Description |
|---|---|---|
| content | array<string> |
Names of SLOs whose status actually changed this time; [] if no change; order is not guaranteed. |
| content[] | string | The name of one SLO whose status changed. |
{
"code": 200,
"content": [
"Payment Service Availability"
],
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
{
"code": 200,
"content": [],
"errorCode": "",
"message": "",
"success": true,
"traceId": "TRACE-EXAMPLE"
}
Error Response¶
For authentication, rate limiting, and common request errors, see Common Error Definitions.
| HTTP Status | errorCode | Trigger Condition | Message or Response Description | Handling |
|---|---|---|---|---|
| 406 | ft.ParameterValidationFailed | Request field is missing, or the field value violates the declared validation conditions | Parameter parsing failed | Check the parameter location, field name, type, and value. |
| 400 | ft.RequestJsonFormatError | Invalid request JSON syntax | Request JSON format error | Fix the JSON according to content.reason, line, and column. |
| 400 | ft.JsonFormatError | JSON top level is not an object | Partial JSON file format error | Submit an object. |
| 400 | ft.OuterFuncFailed | Remote scheduling service returns a failure | External function call failed (some branches use the downstream message) | Check message and traceId; ask the administrator to verify scheduling availability and the current configuration status, then retry. |
| 400 | ft.SameSetTraggerExists | Remote scheduling service reports that an identical trigger configuration already exists | A trigger with the same configuration already exists | First verify this SLO and remote scheduling, and handle residual/duplicate configurations before submitting again. |
| 500 | ft.InternalServerError | Database/cache, task queue, invalid array member, or unhandled downstream exception; remote changes may already have occurred | Internal error | First check the target SLO configuration and current scheduling status; for a deletion failure, also verify the deleted status, and do not blindly repeat creation or batch overwrite. |