You can call this operation to query details about a template, including stacks, stack groups, and change sets associated with the template.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | GetTemplate |
The operation that you want to perform. Set the value to GetTemplate. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the stack or the stack group. You can call the DescribeRegions operation to query the most recent region list. |
StackId | String | No | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
The ID of the stack. Note You can specify only one of StackId, ChangeSetId, StackGroupName, and TemplateId.
|
ChangeSetId | String | No | 1f6521a4-05af-4975-afe9-bc4b45ad**** |
The ID of the change set. Note You can specify only one of 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. The TemplateId value and TemplateARN value of a shared template are the same. The TemplateId value is used to query the shared template. Note You can specify only one of StackId, ChangeSetId, StackGroupName, and TemplateId.
|
TemplateVersion | String | No | v1 |
The version of the template. This parameter takes effect only when the TemplateId parameter is specified. If the template is a shared template, you can specify this parameter only when the VersionOption parameter is set to AllVersions. Valid values: v1 to v100. |
TemplateStage | String | No | Processed |
The stage of the template. This parameter takes effect only when the StackId, ChangeSetId, or StackGroupName parameter is specified. Default value: Processed. Valid values:
|
IncludePermission | String | No | Enabled |
Specifies whether to query the template sharing information. Default value: Disabled. Valid values:
|
StackGroupName | String | No | MyStackGroup |
The name of the stack group. Note You can specify only one of StackId, ChangeSetId, StackGroupName, and TemplateId.
|
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
ChangeSetId | String | e85abe0c-6528-43fb-ae93-fdf8de22**** |
The ID of the change set. This parameter is returned only when the ChangeSetId parameter is specified. |
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
|
Description | String | ROS template for create ECS instance. |
The description of the template. This parameter is returned only when the TemplateId parameter is specified. |
OwnerId | String | 151266687691**** |
The ID of the Alibaba Cloud account that owns the template. This parameter is returned only when the TemplateId parameter is specified. |
Permissions | Array of Permission |
Detailed about the sharing status of the template. This parameter is returned only when the TemplateId parameter is specified and the IncludePermission parameter is set to Enabled. Note
|
|
AccountId | String | 142437958638**** |
The ID of the Alibaba Cloud account with which the template is shared. |
ShareOption | String | ShareToAccounts |
The sharing option. A value of ShareToAccounts indicates that the template is shared with other Alibaba Cloud accounts. |
TemplateVersion | String | v1 |
The version of the shared template. This parameter is returned when ShareOption is set to ShareToAccounts and VersionOption is set to Specified or Current. Valid values: v1 to v100. |
VersionOption | String | AllVersions |
The sharing option of the version. This parameter is returned when ShareOption is set to ShareToAccounts. Valid values:
|
RegionId | String | cn-hangzhou |
The region ID of the stack or the stack group. This parameter is returned only when the StackId, ChangeSetId, or StackGroupName parameter is specified. |
RequestId | String | B288A0BE-D927-4888-B0F7-B35EF84**** |
The ID of the request. |
ShareType | String | Private |
The sharing type of the template. This parameter is returned only when the TemplateId parameter is specified. Valid values:
|
StackGroupName | String | MyStackGroup |
The name of the stack group. This parameter is returned only when the StackGroupName parameter is specified. |
StackId | String | 4a6c9851-3b0f-4f5f-b4ca-a14bf691**** |
The ID of the stack. This parameter is returned only when the StackId parameter is specified. |
TemplateARN | String | acs:ros:*:151266687691****:template/a52f81be-496f-4e1c-a286-8852ab54**** |
The ARN of the template. This parameter is returned only when the TemplateId parameter is specified. |
TemplateBody | String | {"ROSTemplateFormatVersion": "2015-09-01"} |
The content of the template. |
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 this parameter is the same as that of the TemplateARN parameter. |
TemplateName | String | MyTemplate |
The name of the template. This parameter is returned only when the TemplateId parameter is specified. Note
|
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, this parameter value indicates the current version of the template. If the template is a shared template, this parameter is returned only when the VersionOption parameter is set to AllVersions. |
UpdateTime | String | 2020-12-07T06:11:48.000000 |
The last time when the version was modified. This parameter is returned only when the TemplateId parameter is specified. Note
|
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
<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.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
{
"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.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, 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 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, and 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 stack group name. |