All Products
Search
Document Center

GetTemplate

Last Updated: Sep 02, 2019

You can call this operation to query the information of a template.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateTemplate The operation that you want to perform. Set this parameter to GetTemplate.
TemplateName String Yes MyTemplate The name of the template. The name must be 200 characters in length. The name must contain letters, digits, hyphen (-), and underscore (_).
TemplateVersion String No v1 The version of the template. The name consists of the letter v and a digit. Valid values: v1 to v200.

Response parameters

Parameter Type Example Description
RequestId String 14A07460-EBE7-47CA-9757-12CC4761D47A The ID of the request.
Content String “{\n \”FormatVersion\”: \”OOS-2019-06-01\”,\n \”Parameters\”: {\n \”Status\”: {\n \”Type\”: \”String\”,\n \”Description\”: \”(Required) The ID of the ECS instance.\”\n }\n },\n \”Tasks\”: [\n {\n \”Name\”: \”bar\”,\n \”Properties\”: {\n \”Parameters\”: {\n \”Status\”: \”{{ Status }}\”\n },\n \”API\”: \”DescribeInstances\”,\n \”Service\”: \”Ecs\”\n },\n \”Action\”: \”acs::ExecuteAPI\”,\n \”Outputs\”: {\n \”InstanceIds\”: {\n \”ValueSelector\”: \”.Instances.Instance[].InstanceId\”,\n \”Type\”: \”List\”\n }\n }\n }\n ],\n \”Outputs\”: {\n \”InstanceIds\”: {\n \”Value\”: \” {{ bar.InstanceIds }} \”,\n \”Type\”: \”List\”\n }\n }\n}\n” The content of the template.
Template List N/A The metadata of the template.
└ CreatedBy String root(1300000) The user who created the template.
└ CreatedDate String 2019-05-16T10:26:14Z The time when the template was created.
└ UpdatedBy String root(130000) The user who updated the template.
└ UpdatedDate String 2019-05-16T10:26:14Z The time when the template was updated.
└ Description String Describe instances of given status The description of the template.
└ Hash String 4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4 The encrypted SHA-256 hash code of the template content.
└ ShareType String Private The sharing mode of the template. The sharing mode of templates created by users is set to Private.
└ TemplateFormat String JSON The format of the template. The format can be JSON or YAML. The system automatically identifies the format.
└ TemplateName String MyTemplate The name of the template.
└ TemplateId String t-94753d38 The ID of the template.
└ TemplateVersion String v1 The version of the template. The version name consists of the letter v and a digit. The digit starts from 1.

Examples

Sample request

  1. https://oos.cn-hangzhou.aliyuncs.com/?Action=GetTemplate
  2. &TemplateName=MyTemplate
  3. &<Common request parameters>

Sample success response
JSON format

  1. {
  2. "Content": "{\n \"FormatVersion\": \"OOS-2019-06-01\",\n \"Parameters\": {\n \"Status\": {\n \"Type\": \"String\",\n \"Description\": \"(Required) The ID of the ECS instance.\"\n }\n },\n \"Tasks\": [\n {\n \"Name\": \"bar\",\n \"Properties\": {\n \"Parameters\": {\n \"Status\": \"{{ Status }}\"\n },\n \"API\": \"DescribeInstances\",\n \"Service\": \"Ecs\"\n },\n \"Action\": \"acs::ExecuteAPI\",\n \"Outputs\": {\n \"InstanceIds\": {\n \"ValueSelector\": \".Instances.Instance[].InstanceId\",\n \"Type\": \"List<String>\"\n }\n }\n }\n ],\n \"Outputs\": {\n \"InstanceIds\": {\n \"Value\": \" {{ bar.InstanceIds }} \",\n \"Type\": \"List<String>\"\n }\n }\n}\n",
  3. "RequestId": "FAAFCA45-AB65-4049-BFE0-868E1C8025AF",
  4. "Template": {
  5. "CreatedBy": "root(130000)",
  6. "CreatedDate": "2019-05-27T10:32:52Z",
  7. "UpdatedBy": "root(130000)",
  8. "UpdatedDate": "2019-05-27T08:46:33Z",
  9. "Description": "",
  10. "Hash": "62eac5c64b9dae5c41e1e8b648baad95f812cab4f9221a5283edb882b5f8d712",
  11. "ShareType": "Private",
  12. "TemplateFormat": "JSON",
  13. "TemplateName": "MyTemplate",
  14. "TemplateId": "t-9475828d38",
  15. "TemplateVersion": "v1"
  16. }
  17. }

Error codes

Error code HTTP status code Error message Description
InvalidVersion 400 The specified Version is invalid. The error message returned because the specified version is invalid. Specify a valid version in the URL and try again.
InvalidAction.NotFound 400 Specified api is not found, please check your url and method. The error message returned because the specified operation does not exist. Specify a valid value for the Action parameter.
Throttling.User 400 Your request was denied due to instance flow control. The error message returned because too many requests have been sent over a short period of time. Try again later.
User.NoPermission 401 User has no permission to do the action: ({api_name}) The error message returned because the user is not authorized to call this operation. Check whether the current user has the permission to call the OOS API in the RAM console.
InvalidStsToken 400 Invalid STS token to do the action: ({api_name}) The error message returned because the specified STS token is invalid.
ExpiredStsToken 400 Expired STS token to do the action: ({api_name}) The error message returned because the specified STS token has expired.
InvalidAccountType 400 The account type ({account_type}) was not supported. The error message returned because the specified account type is not supported.
EntityNotExists.Template 404 The specified parameter RamRoleName does not exist. The error message returned because the specified template does not exist.