Queries the details of a template. For example, you can call the operation to query the stack, stack group, and change set defined in a custom template.
In this example, the details of a template whose ID is 5ecd1e10-b0e9-4389-a565-e4c15efc****
and region ID is cn-hangzhou
are queried.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetTemplate |
The operation that you want to perform. Set the value to GetTemplate. |
StackId | String | No | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
The ID of the stack. Note You must specify only one of the following parameters: StackId, ChangeSetId, StackGroupName,
and TemplateId.
|
RegionId | String | Yes | cn-hangzhou |
The ID of the region to which the stack or stack group defined in the template belongs. You can call the DescribeRegions operation to query the most recent region list. |
ChangeSetId | String | No | 1f6521a4-05af-4975-afe9-bc4b45ad**** |
The ID of the change set. Note You must specify only one of the following parameters: StackId, ChangeSetId, StackGroupName,
and TemplateId.
|
TemplateId | String | No | 5ecd1e10-b0e9-4389-a565-e4c15efc**** |
The ID of the template. This parameter applies to shared and private templates. If the template is a shared template, the value of the TemplateId parameter is the same as the value of the TemplateARN parameter. You can use the template ID to query a shared template. Note You must specify only one of the following parameters: StackId, ChangeSetId, StackGroupName,
and TemplateId.
|
TemplateVersion | String | No | v1 |
The version of the template. This parameter only takes effect when you specify the TemplateId parameter. If the template is a shared template, you can specify this parameter only if you set the VersionOption parameter to AllVersions. Valid values: v1 to v100. |
TemplateStage | String | No | Processed |
The stage of the template. This parameter only takes effect when you specify the StackId, ChangeSetId, or StackGroupName parameter. Default value: Processed. Valid values:
|
IncludePermission | String | No | Enabled |
Specifies whether to query the template sharing information. Default value: Disabled. Valid values:
Note Only the template owner can query the template sharing information.
|
StackGroupName | String | No | MyStackGroup |
The name of the stack group. Note You must specify only one of the following parameters: StackId, ChangeSetId, StackGroupName,
and TemplateId.
|
IncludeTags | String | No | Enabled |
Specifies whether to query the information about tags. Default value: Disabled. Valid values:
Note This parameter only takes effect when you specify the TemplateId parameter.
|
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
TemplateARN | String | acs:ros:*:151266687691****:template/a52f81be-496f-4e1c-a286-8852ab54**** |
The Alibaba Cloud Resource Name (ARN) of the template. This parameter is returned only if the TemplateId parameter is specified. |
Description | String | ROS template for create ECS instance. |
The description of the template. This parameter is returned only if the TemplateId parameter is specified. |
RequestId | String | B288A0BE-D927-4888-B0F7-B35EF84**** |
The ID of the request. |
CreateTime | String | 2020-11-18T08:49:26 |
The time when the template was created. This parameter is returned only if the TemplateId parameter is specified. Note
|
StackGroupName | String | MyStackGroup |
The name of the stack group. This parameter is returned only if the StackGroupName parameter is specified. |
TemplateVersion | String | v1 |
The version of the template. This parameter is returned only if the TemplateId parameter is specified. If the TemplateVersion parameter is not specified or does not take effect, the value of this parameter is the default version of the template. If the template is a shared template, this parameter is returned only if the VersionOption parameter is set to AllVersions. |
TemplateBody | String | {"ROSTemplateFormatVersion": "2015-09-01"} |
The body of the template. |
ChangeSetId | String | e85abe0c-6528-43fb-ae93-fdf8de22**** |
The ID of the change set. This parameter is returned only if the ChangeSetId parameter is specified. |
OwnerId | String | 151266687691**** |
The ID of the Alibaba Cloud account to which the template belongs. This parameter is returned only if the TemplateId parameter is specified. |
UpdateTime | String | 2020-12-07T06:11:48 |
The time when the template was last updated. This parameter is returned only if the TemplateId parameter is specified. Note
|
Permissions | Array of Permission |
Details of the sharing status of the template. This parameter is returned only if the TemplateId parameter is specified and the IncludePermission parameter is set to Enabled. Note
|
|
VersionOption | String | AllVersions |
The version option for the shared template. This parameter is returned only if the ShareOption parameter is set to ShareToAccounts. Valid values:
|
AccountId | String | 142437958638**** |
The ID of the Alibaba Cloud account with which the template is shared. |
ShareOption | String | ShareToAccounts |
The sharing option. The value is set to ShareToAccounts, which indicates that the template is shared with one or more Alibaba Cloud accounts. |
TemplateVersion | String | v1 |
The version of the shared template. This parameter is returned only if the ShareOption parameter is set to ShareToAccounts and the VersionOption parameter is set to Specified or Current. Valid values: v1 to v100. |
ShareSource | String | ROS |
The service that is used for resource sharing. Valid values:
Note
|
TemplateName | String | MyTemplate |
The name of the template. This parameter is returned only if the TemplateId parameter is specified. Note
|
RegionId | String | cn-hangzhou |
The ID of the region to which the stack or stack group defined in the template belongs. This parameter is returned only if the StackId, ChangeSetId, or StackGroupName parameter is specified. |
TemplateId | String | a52f81be-496f-4e1c-a286-8852ab54**** |
The ID of the template. This parameter is returned only if the TemplateId parameter is specified. If the template is a shared template, the value of this parameter is the same as the value of the TemplateARN parameter. |
StackId | String | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
The ID of the stack. This parameter is returned only if the StackId parameter is specified. |
ShareType | String | Private |
The sharing type of the template. This parameter is returned only if the TemplateId parameter is specified. Valid values:
|
ResourceGroupId | String | rg-acfmxazb4ph6aiy**** |
The ID of the resource group. |
Interface | String | {} |
The description of the web UI in the ROS console. |
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=GetTemplate
&RegionId=cn-hangzhou
&TemplateId=5ecd1e10-b0e9-4389-a565-e4c15efc****
&IncludePermission=Enabled
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<GetTemplateResponse>
<TemplateARN>acs:ros:*:151266687691****:template/a52f81be-496f-4e1c-a286-8852ab54****</TemplateARN>
<Description>ROS template for create ECS instance.</Description>
<RequestId>B288A0BE-D927-4888-B0F7-B35EF84****</RequestId>
<CreateTime>2020-11-18T08:49:26</CreateTime>
<StackGroupName>MyStackGroup</StackGroupName>
<TemplateVersion>v1</TemplateVersion>
<TemplateBody>{"ROSTemplateFormatVersion": "2015-09-01"}</TemplateBody>
<ChangeSetId>e85abe0c-6528-43fb-ae93-fdf8de22****</ChangeSetId>
<OwnerId>151266687691****</OwnerId>
<UpdateTime>2020-12-07T06:11:48</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>a52f81be-496f-4e1c-a286-8852ab54****</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>
</GetTemplateResponse>
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" : "B288A0BE-D927-4888-B0F7-B35EF84****",
"CreateTime" : "2020-11-18T08:49:26",
"StackGroupName" : "MyStackGroup",
"TemplateVersion" : "v1",
"TemplateBody" : "{\"ROSTemplateFormatVersion\": \"2015-09-01\"}",
"ChangeSetId" : "e85abe0c-6528-43fb-ae93-fdf8de22****",
"OwnerId" : "151266687691****",
"UpdateTime" : "2020-12-07T06:11:48",
"Permissions" : {
"VersionOption" : "AllVersions",
"AccountId" : "142437958638****",
"ShareOption" : "ShareToAccounts",
"TemplateVersion" : "v1",
"ShareSource" : "ROS"
},
"TemplateName" : "MyTemplate",
"RegionId" : "cn-hangzhou",
"TemplateId" : "a52f81be-496f-4e1c-a286-8852ab54****",
"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, visit the API Error Center.
HTTP status code |
Error code |
Error message |
Description |
---|---|---|---|
404 |
ChangeSetNotFound |
The ChangeSet ({name}) of Stack ({stack}) could not be found. |
The error message returned because the specified change set does not exist. name indicates the name or ID of the change set, and stack indicates the name or ID of the stack. |
404 |
ChangeSetNotFound |
The ChangeSet {ID} could not be found. |
The error message returned because the specified change set does not exist. ID indicates the ID of the change set. |
404 |
StackNotFound |
The Stack ({name}) could not be found. |
The error message returned because the stack does not exist. name indicates the name or ID of the stack. |
404 |
TemplateNotFound |
The Template { ID } could not be found. |
The error message returned because the specified template does not exist. ID indicates the template ID. |
404 |
TemplateNotFound |
The Template { ID } with version { version } could not be found. |
The error message returned because the specified template or template version does not exist. ID indicates the template ID. version indicates the template version. |
404 |
StackGroupNotFound |
The StackGroup ({name}) could not be found. |
The error message returned because the specified stack group does not exist. name indicates the name of the stack group. |