Queries the details of a template, for example, a custom template. The details include the information about the stack, stack group, and change set that are specified in the 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 region ID of the stack or stack group that you specify in the template. 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 that is returned by Resource Orchestration Service (ROS). 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 shared information about the template. Default value: Disabled. Valid values:
|
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.
|
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 when the TemplateId parameter is specified. |
Description | String | ROS template for create ECS instance. |
The description of the template. This parameter is returned only when the TemplateId parameter is specified. |
RequestId | String | B288A0BE-D927-4888-B0F7-B35EF84**** |
The ID of the request. |
CreateTime | String | 2020-11-18T08:49:26.000000 |
The time when the template was created. This parameter is returned only when the TemplateId parameter is specified. Note
|
StackGroupName | String | MyStackGroup |
The name of the stack group. This parameter is returned only when the StackGroupName parameter is specified. |
TemplateVersion | String | v1 |
The version of the template. This parameter is returned only when 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 when 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 when 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 when the TemplateId parameter is specified. |
UpdateTime | String | 2020-12-07T06:11:48.000000 |
The time when the template was last updated. This parameter is returned only when the TemplateId parameter is specified. Note
|
Permissions | Array of Permission |
The shared information about the template. This parameter is returned only when 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 when 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 when 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 when the TemplateId parameter is specified. Note
|
RegionId | String | cn-hangzhou |
The region ID of the stack or stack group that is specified in the template. This parameter is returned only when 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 when the TemplateId parameter is specified. If the template is a shared template, the value of the TemplateId 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 when the StackId parameter is specified. |
ShareType | String | Private |
The sharing type of the template. This parameter is returned only when 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. |
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>
<ResourceGroupId>rg-acfmxazb4ph6aiy****</ResourceGroupId>
<Description>ROS template for create ECS instance.</Description>
<RequestId>B288A0BE-D927-4888-B0F7-B35EF84****</RequestId>
<CreateTime>2020-11-18T08:49:26.000000</CreateTime>
<TemplateVersion>v1</TemplateVersion>
<TemplateBody>{"ROSTemplateFormatVersion": "2015-09-01"}</TemplateBody>
<OwnerId>151266687691****</OwnerId>
<UpdateTime>2020-12-07T06:11:48.000000</UpdateTime>
<Permissions>
<ShareOption>ShareToAccounts</ShareOption>
<TemplateVersion>v1</TemplateVersion>
<AccountId>142437958638****</AccountId>
<VersionOption>AllVersions</VersionOption>
</Permissions>
<TemplateName>MyTemplate</TemplateName>
<TemplateId>a52f81be-496f-4e1c-a286-8852ab54****</TemplateId>
<ShareType>Private</ShareType>
</GetTemplateResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"TemplateARN" : "acs:ros:*:151266687691****:template/a52f81be-496f-4e1c-a286-8852ab54****",
"ResourceGroupId" : "rg-acfmxazb4ph6aiy****",
"Description" : "ROS template for create ECS instance.",
"RequestId" : "B288A0BE-D927-4888-B0F7-B35EF84****",
"CreateTime" : "2020-11-18T08:49:26.000000",
"TemplateVersion" : "v1",
"TemplateBody" : "{\"ROSTemplateFormatVersion\": \"2015-09-01\"}",
"OwnerId" : "151266687691****",
"UpdateTime" : "2020-12-07T06:11:48.000000",
"Permissions" : [ {
"ShareOption" : "ShareToAccounts",
"TemplateVersion" : "v1",
"AccountId" : "142437958638****",
"VersionOption" : "AllVersions"
} ],
"TemplateName" : "MyTemplate",
"TemplateId" : "a52f81be-496f-4e1c-a286-8852ab54****",
"ShareType" : "Private"
}
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. 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 specified 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. |