Queries the list of templates.

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 ListTemplates

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

PageNumber Long No 1

The number of the page to return.

Pages start from page 1.

Default value: 1.

PageSize Long No 10

The number of entries to return on each page.

Valid values: 1 to 50.

Default value: 10.

TemplateName String No MyTemplate

The name of the template. This parameter takes effect only when the ShareType parameter is set to Private.

The name can be up to 255 characters in length, and can contain digits, letters, hyphens (-), and underscores (_). The name must start with a digit or letter.

ShareType String No Private

The sharing type of the template.

Default value: Private. Valid values:

  • Private: The template belongs to the template owner.
  • Shared: The template is shared with other users.
  • Official: The template is the shared template of the official version.
Tag.N.Key String No usage

The key of tag N. This parameter takes effect only when the ShareType parameter is set to Private.

You can specify up to 20 tag keys.

Tag.N.Value String No deploy

The value of the tag N. This parameter takes effect only when the ShareType parameter is set to Private.

You can specify up to 20 tag values.

ResourceGroupId String No rg-acfmxazb4ph6aiy****

The ID of the resource group.

For more information about resource groups, see the "Resource Group" section of the What is Resource Management? topic.

IncludeTags String No Enabled

Specifies whether to query the information about tags. Default value: Disabled. Valid values:

  • Enabled
  • Disabled

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

Response parameters

Parameter Type Example Description
TotalCount Integer 1

The total number of templates.

PageSize Integer 10

The number of entries returned per page.

RequestId String C3A8413B-1F16-4DED-AC3E-61A00718DE8A

The ID of the request.

PageNumber Integer 1

The page number of the returned page.

Pages start from page 1.

Templates Array of Template

The list of templates.

TemplateARN String acs:ros:*:151266687691****:template/a52f81be-496f-4e1c-a286-8852ab54****

The Alibaba Cloud Resource Name (ARN) of the template.

UpdateTime String 2019-10-15T08:17:14.000000

The time when the template was last updated.

Description String test-description

The description of the template.

CreateTime String 2019-10-15T08:17:14.000000

The time when the template was created.

TemplateName String demo

The name of the template.

TemplateVersion String v1

The latest version of the template.

TemplateId String 4d4f5aa2-3260-4e47-863b-763fbb12****

The ID of the template.

OwnerId String 151266687691****

The ID of the Alibaba Cloud account to which the template belongs.

ShareType String Private

The sharing type of the template.

Default value: Private. Valid values:

  • Private: The template belongs to the template owner.
  • Shared: The template is shared with other users.
ResourceGroupId String rg-acfmxazb4ph6aiy****

The ID of the resource group.

Tags Array of Tags

The tags of the template.

Key String usage

The key of the tag.

Value String test

The value of the tag.

Examples

Sample requests

http(s)://ros.aliyuncs.com/?Action=ListTemplates
&<Common request parameters>

Sample success responses

XML format

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

<ListTemplatesResponse>
    <TemplateARN>acs:ros:*:151266687691****:template/a52f81be-496f-4e1c-a286-8852ab54****</TemplateARN>
    <Description>ROS template for create ECS instance.</Description>
    <RequestId>C3A8413B-1F16-4DED-AC3E-61A00718DE8A</RequestId>
    <CreateTime>2019-10-15T08:17:14.000000</CreateTime>
    <StackGroupName>MyStackGroup</StackGroupName>
    <TemplateVersion>v1</TemplateVersion>
    <TemplateBody>{"ROSTemplateFormatVersion": "2015-09-01"}</TemplateBody>
    <ChangeSetId>e85abe0c-6528-43fb-ae93-fdf8de22****</ChangeSetId>
    <OwnerId>151266687691****</OwnerId>
    <UpdateTime>2019-10-15T08:17:14.000000</UpdateTime>
    <Permissions>
        <VersionOption>AllVersions</VersionOption>
        <AccountId>142437958638****</AccountId>
        <ShareOption>ShareToAccounts</ShareOption>
        <TemplateVersion>v1</TemplateVersion>
        <ShareSource>ROS</ShareSource>
    </Permissions>
    <TemplateName>MyTemplate</TemplateName>
    <RegionId>cn-hangzhou</RegionId>
    <TemplateId>4d4f5aa2-3260-4e47-863b-763fbb12****</TemplateId>
    <StackId>4a6c9851-3b0f-4f5f-b4ca-a14bf691****</StackId>
    <ShareType>Private</ShareType>
    <ResourceGroupId>rg-acfmxazb4ph6aiy****</ResourceGroupId>
    <Interface>{}</Interface>
    <Tags>
        <Key>usage</Key>
        <Value>test</Value>
    </Tags>
</ListTemplatesResponse>

JSON format

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

{
  "TemplateARN" : "acs:ros:*:151266687691****:template/a52f81be-496f-4e1c-a286-8852ab54****",
  "Description" : "ROS template for create ECS instance.",
  "RequestId" : "C3A8413B-1F16-4DED-AC3E-61A00718DE8A",
  "CreateTime" : "2019-10-15T08:17:14.000000",
  "StackGroupName" : "MyStackGroup",
  "TemplateVersion" : "v1",
  "TemplateBody" : "{\"ROSTemplateFormatVersion\": \"2015-09-01\"}",
  "ChangeSetId" : "e85abe0c-6528-43fb-ae93-fdf8de22****",
  "OwnerId" : "151266687691****",
  "UpdateTime" : "2019-10-15T08:17:14.000000",
  "Permissions" : {
    "VersionOption" : "AllVersions",
    "AccountId" : "142437958638****",
    "ShareOption" : "ShareToAccounts",
    "TemplateVersion" : "v1",
    "ShareSource" : "ROS"
  },
  "TemplateName" : "MyTemplate",
  "RegionId" : "cn-hangzhou",
  "TemplateId" : "4d4f5aa2-3260-4e47-863b-763fbb12****",
  "StackId" : "4a6c9851-3b0f-4f5f-b4ca-a14bf691****",
  "ShareType" : "Private",
  "ResourceGroupId" : "rg-acfmxazb4ph6aiy****",
  "Interface" : "{}",
  "Tags" : [ {
    "Key" : "usage",
    "Value" : "test"
  } ]
}

Error codes

For a list of error codes, see Service error codes.