Help Center/ Cloud Eye/ API Reference/ API/ Alarms/ Alarm Rules/ Enabling or Disabling an Alarm Rule
Updated on 2026-06-11 GMT+08:00

Enabling or Disabling an Alarm Rule

Function

This API is used to enable or disable an alarm rule.

You can call the API V1 to configure only one alarm rule with one policy per resource. You are advised to use the console functions and the API for Batch Enabling or Disabling Alarm Rules.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    ces:alarms:putAction

    Write

    alarm *

    • g:ResourceTag/<tag-key>

    • g:EnterpriseProjectId

    ces:alarms:put

    -

URI

PUT /V1.0/{project_id}/alarms/{alarm_id}/action

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. It is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID.

Constraints

N/A

Range

1 to 64 characters.

Default Value

N/A

alarm_id

Yes

String

Definition:

Alarm rule ID.

Constraints:

N/A

Range:

The value starts with al and is followed by 22 characters of letters, digits, or a combination of both. It contains 24 characters.

Default Value:

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

String

Definition

MIME type of the request body.

Constraints

N/A

Range

1 to 64 characters

Default Value

Default value application/json; charset=UTF-8 is recommended. For APIs used to upload objects or images, the MIME type varies with the flow type.

X-Auth-Token

No

String

Definition

User token.

Constraints

N/A

Range

1 to 16,384 characters

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

alarm_enabled

Yes

Boolean

Definition

Whether the alarm rule is enabled.

Constraints

N/A

Range

  • true: enabled.

  • false: disabled.

Default Value

N/A

Response Parameters

Status code: 204

No Content

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

-

String

Request error.

Status code: 401

Table 5 Response body parameters

Parameter

Type

Description

-

String

The authentication information is not provided or is incorrect.

Status code: 403

Table 6 Response body parameters

Parameter

Type

Description

-

String

Access to the requested page is forbidden.

Status code: 408

Table 7 Response body parameters

Parameter

Type

Description

-

String

The request timed out.

Status code: 429

Table 8 Response body parameters

Parameter

Type

Description

-

String

Too many requests.

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

-

String

Failed to complete the request because of an internal service error.

Status code: 503

Table 10 Response body parameters

Parameter

Type

Description

-

String

The system is currently unavailable.

Example Requests

{
  "alarm_enabled" : true
}

Example Responses

None

Status Codes

Status Code

Description

204

No Content

400

Bad Request

401

Unauthorized

403

Forbidden

408

Request Timeout

429

Too Many Requests

500

Internal Server Error

503

Service Unavailable

Error Codes

See Error Codes.