You can call this operation to add or modify the message resource of an alert rule.
This operation only supports Message Notification Service (MNS) as the message service.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | PutMetricRuleTargets |
The operation that you want to perform. Set the value to PutMetricRuleTargets. |
RuleId | String | Yes | rulexx12346 |
The ID of the alert rule. |
Targets.N.Arn | String | Yes | acs:mns:cn-hangzhou:111:/queues/test/message |
The resource description in the format of
|
Targets.N.Id | String | Yes | 1 |
The ID of the message resource. The ID must be unique in the alert rule. |
Targets.N.Level | String | No | ["INFO", "WARN", "CRITICAL"] |
The alert level, which is a JSON array. Valid values:
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | 200 |
The status code. Note The status code 200 indicates a successful call, whereas any other status code indicates
a failed call.
|
FailData | Struct |
The list of error data. If any error occurs, the specific error information will be returned. If no error occurs, this field will not be returned. |
|
Targets | Array |
The list of the message resources that failed to be added or modified. |
|
Target | |||
Arn | String | acs:mns:cn-hangzhou:111:/queues/test/message |
The resource description in the format of
|
Id | String | 1 |
The ID of the message resource. |
Level | String | ["INFO", "WARN", "CRITICAL"] |
The alert level, which is a JSON array. Valid values:
|
Message | String | success |
The returned message. |
RequestId | String | 786E92D2-AC66-4250-B76F-F1E2FCDDBA1C |
The ID of the request, which can be used for troubleshooting. |
Success | Boolean | true |
Indicates whether the operation was successful. Valid values:
|
Examples
Sample requests
http(s)://[Endpoint]/? Action=PutMetricRuleTargets
&RuleId=rulexx12346
&<Common request parameters>
Sample success responses
XML
format
<PutMetricRuleTargetsResponse>
<Message>Success</Message>
<Success>true</Success>
<RequestId>786E92D2-AC66-4250-B76F-F1E2FCDDBA1C</RequestId>
<FailData>
<Targets>
<Arn>acs:mns:cn-hangzhou:111:/queues/test/message</Arn>
<Id>1</Id>
<Level>INFO</Level>
<Level>WARN</Level>
<Level>CRITICAL</Level>
</Targets>
</FailData>
</PutMetricRuleTargetsResponse>
JSON
format
{
"Code":"200",
"Message":"Success",
"Success":true,
"RequestId":"786E92D2-AC66-4250-B76F-F1E2FCDDBA1C",
"FailData":{
"Targets":[
{
"Arn":"acs:mns:cn-hangzhou:111:/queues/test/message",
"Id":1,
"Level":["INFO", "WARN", "CRITICAL"]
}
]
}
}
Error codes
For a list of error codes, visit the API Error Center.