Adds or modifies the targets to which alert notifications are sent based on an event-triggered alert rule.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes PutEventRuleTargets

The operation that you want to perform. Set the value to PutEventRuleTargets.

RuleName String Yes testEventRule

The name of the event-triggered alert rule.

FcParameters.N.Id String No 1

The ID of the target if alert notifications are sent to Function Compute. Valid values of N: 1 to 5.

FcParameters.N.Region String No cn-hangzhou

The region where Function Compute is deployed. Valid values of N: 1 to 5.

FcParameters.N.ServiceName String No fc-test

The name of the Function Compute service. Valid values of N: 1 to 5.

FcParameters.N.FunctionName String No fc-test

The name of the function. Valid values of N: 1 to 5.

ContactParameters.N.Id String No 2

The ID of the target if alert notifications are sent to alert contacts of an alert group. Valid values of N: 1 to 5.

ContactParameters.N.ContactGroupName String No Default alert group

The name of the alert group. Valid values of N: 1 to 5.

ContactParameters.N.Level String No 3

The alert notification methods. Valid values of N: 1 to 5. Valid values:

Set the value to 4. The value 4 indicates that alert notifications are sent by using DingTalk chatbots and emails.

MnsParameters.N.Id String No 3

The ID of the target if alert notifications are sent to Message Service (MNS). Valid values of N: 1 to 5.

MnsParameters.N.Region String No cn-hangzhou

The region where MNS is deployed. Valid values of N: 1 to 5.

MnsParameters.N.Queue String No queue1

The name of the MNS queue. Valid values of N: 1 to 5.

WebhookParameters.N.Id String No 4

The ID of the target if alert notifications are sent by sending a request to a callback URL. Valid values of N: 1 to 5.

WebhookParameters.N.Protocol String No http

The protocol used to send a request. Valid values of N: 1 to 5. Valid values:

  • http
  • telnet
  • ping
WebhookParameters.N.Url String No http://www.aliyun.com

The callback URL. Valid values of N: 1 to 5.

WebhookParameters.N.Method String No GET

The HTTP request method. Valid values of N: 1 to 5.

Valid values: GET and POST.

SlsParameters.N.Id String No 5

The ID of the target if alert notifications are sent to Log Service. Valid values of N: 1 to 5.

SlsParameters.N.Region String No cn-hangzhou

The region where Log Service is deployed. Valid values of N: 1 to 5.

SlsParameters.N.Project String No testproject

The name of the Log Service project. Valid values of N: 1 to 5.

SlsParameters.N.LogStore String No testlogstore

The name of the Log Service Logstore. Valid values of N: 1 to 5.

Response parameters

Parameter Type Example Description
RequestId String 409C64DA-CF14-45DF-B463-471C790DD15A

The ID of the request.

Code String 200

The HTTP status code.

Note The status code 200 indicates that the call was successful.
Success Boolean true

Indicates whether the call was successful. The value true indicates a success. The value false indicates a failure.

FailedParameterCount String 2

The number of targets that failed to be created or modified.

FailedFcParameters Array N/A

This parameter is returned if the specified functions in the request failed to be created or modified in Function Compute.

FcParameter N/A N/A N/A
FunctionName String functionTest1

The name of the function.

Id Integer 1

The ID of the target.

Region String cn-hangzhou

The ID of the region.

ServiceName String serviceTest1

The name of the Function Compute service.

FailedMnsParameters Array N/A

This parameter is returned if the specified queues in the request failed to be created or modified in MNS.

MnsParameter N/A N/A N/A
Id Integer 2

The ID of the target.

Queue String testQueue

The name of the MNS queue.

Region String cn-hangzhou

The ID of the region.

FailedContactParameters Array N/A

This parameter is returned if the specified alert groups in the request failed to be created or modified.

ContactParameter N/A N/A N/A
ContactGroupName String Default alert group

The name of the alert group.

Id Integer 2

The ID of the target.

Level String 3

The alert notification methods. Valid values:

The value 4 indicates that alert notifications are sent by using DingTalk chatbots and emails.

Message String The Request is not authorization.

The returned message.

Examples

Sample requests

http(s)://[Endpoint]/? Action=PutEventRuleTargets
&RuleName=testEventRule
&<Common request parameters>

Sample success responses

XML format

<DeleteCustomMetric>
          <RequestId>681CC49A-DD28-4D11-B86F-19D3F71E0EAE</RequestId>
          <Code>200</Code>
          <Success>true</Success>
</DeleteCustomMetric>

JSON format

{
    "RequestId": "681CC49A-DD28-4D11-B86F-19D3F71E0EAE",
    "Code": "200",
    "Success": true
}

Error codes

For a list of error codes, visit the API Error Center.