Queries alert templates.

This topic provides an example on how to query alert templates. In this example, the following alert templates are returned in the response: ECS_Template1 and ECS_Template2.

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 DescribeMetricRuleTemplateList

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

Name String No ECS_Template1

The name of the alert template.

Keyword String No ECS

The keyword of the alert template name.

TemplateId Long No 70****

The ID of the alert template.

PageNumber Long No 1

The number of the page to return.

Default value: 1

PageSize Long No 10

The number of entries to return on each page.

History Boolean No false

Specifies whether to display the application history of the alert templates. Default value: false. Valid values:

  • true
  • false
Order Boolean No true

The order in which you want to sort alert templates. Default value: true. Valid values:

  • true: ascending order
  • false: descending order
OrderBy String No gmtCreate

The sorting basis. Default value: gmtCreate. Valid values:

  • gmtMotified: Sorts alert templates by modification time.
  • gmtCreate: Sorts alert templates by creation time.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
Code Integer 200

The HTTP status code.

Note The status code 200 indicates that the call was successful.
Message String The Request is not authorization.

The error message.

RequestId String 659401C0-6214-5C02-972A-CFA929D717B7

The ID of the request.

Total Long 2

The total number of returned entries.

Success Boolean true

Indicates whether the call was successful. Valid values:

  • true: The call was successful.
  • false: The call failed.
Templates Array of Template

The list of alert templates.

Template
Description String ECS CPU utilization

The description of the alert template.

GmtCreate Long 1646018798000

The timestamp when the alert template was created.

Unit: milliseconds.

Name String ECS_Template1

The name of the alert template.

RestVersion Long 0

The version of the alert template.

Default value: 0.

GmtModified Long 1646054798000

The timestamp when the alert template was modified.

Unit: milliseconds.

TemplateId Long 70****

The ID of the alert template.

ApplyHistories Array of ApplyHistory

The application history of the alert template.

ApplyHistory
GroupId Long 3607****

The ID of the application group.

GroupName String ECS_Group

The name of the application group.

ApplyTime Long 1646055898000

The timestamp when the alert template was applied to the application group.

Unit: milliseconds.

Examples

Sample requests

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

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeMetricRuleTemplateListResponse>
	<RequestId>659401C0-6214-5C02-972A-CFA929D717B7</RequestId>
	<Total>2</Total>
	<Templates>
		<Template>
			<GmtCreate>1606291110000</GmtCreate>
			<Description></Description>
			<GmtModified>1646018798000</GmtModified>
			<RestVersion>0</RestVersion>
			<TemplateId>70****</TemplateId>
			<Name>ECS_Template1</Name>
		</Template>
		<Template>
			<GmtCreate>1607420429000</GmtCreate>
			<Description></Description>
			<GmtModified>1646017352000</GmtModified>
			<RestVersion>1</RestVersion>
			<TemplateId>71****</TemplateId>
			<Name>ECS_Template2</Name>
		</Template>
	</Templates>
	<Code>200</Code>
	<Success>true</Success>
</DescribeMetricRuleTemplateListResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId": "659401C0-6214-5C02-972A-CFA929D717B7",
  "Total": 2,
  "Templates": {
    "Template": [
      {
        "GmtCreate": 1606291110000,
        "Description": "",
        "GmtModified": 1646018798000,
        "RestVersion": 0,
        "TemplateId": 70****,
        "Name": "ECS_Template1"
      },
      {
        "GmtCreate": 1607420429000,
        "Description": "",
        "GmtModified": 1646017352000,
        "RestVersion": 1,
        "TemplateId": 71****,
        "Name": "ECS_Template2"
      }
    ]
  },
  "Code": 200,
  "Success": true
}

Error codes

HttpCode Error code Error message Description
404 ResourceNotFound The specified resource is not found. The error message returned because the specified resource is not found.

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