Validates the template that is used to create stacks.

In this topic, a template that is used to create stacks is validated. The TemplateURL parameter is set to oss://ros/template/demo.

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 ValidateTemplate

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

TemplateURL String No oss://ros/template/demo

The URL of the file that contains the template body. The URL must point to a template located in an HTTP or HTTPS web server or an Object Storage Service (OSS) bucket. Examples: oss://ros/template/demo and oss://ros/template/demo?RegionId=cn-hangzhou. The template can be up to 524,288 bytes in length.

Note If the region of the OSS bucket is not specified, the RegionId value is used.

You must specify one of the TemplateBody and TemplateURL parameters, but you cannot specify both of them.

The URL can be up to 1,024 bytes in length.

RegionId String No cn-hangzhou

The region ID of the stack template. You can call the DescribeRegions operation to query the most recent region list.

TemplateBody String No {"ROSTemplateFormatVersion":"2015-09-01"}

The structure that contains the template body. The template body must be 1 to 524,288 bytes in length.

If the length of the template body is longer than required, we recommend that you add parameters to the HTTP POST request body to avoid request failures due to excessive length of URLs.

You must specify one of the TemplateBody and TemplateURL parameters, but you cannot specify both of them.

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

Response parameters

Parameter Type Example Description
Description String No description

The description of the stack template.

Parameters Array of Object [{"Description": "", "Label": "param_integer", "NoEcho": "false", "ParameterKey": "param_integer", "Type": "Number"},{ "Description": "", "Label": "param_float", "NoEcho": "false", "ParameterKey": "param_float", "Type": "Number"}]

The input parameters of the stack template.

The input parameters define the parameters that you must specify to create stacks based on the template. These parameters specify information about a stack, such as the username, password, and environment-related Elastic Compute Service (ECS) instance type.

RequestId String B288A0BE-D927-4888-B0F7-B35EF84B6E6

The ID of the request.

Outputs Array of Output

The list of output items of the template.

OutputKey String instance_id

The name of the output item.

Description String The instance ID of my ECS.

The description of the output item.

Examples

Sample requests

http(s)://ros.aliyuncs.com/?Action=ValidateTemplate
&TemplateURL=oss://ros/template/demo
&<Common request parameters>

Sample success responses

XML format

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

<ValidateTemplateResponse>
       <Description type="string">No description</Description>
       <Parameters class="array">
              <Parameter class="object">
                     <Description type="string"></Description>
                     <Label type="string">param_integer</Label>
                     <NoEcho type="string">false</NoEcho>
                     <ParameterKey type="string">param_integer</ParameterKey>
                     <Type type="string">Number</Type>
              </Parameter>
              <Parameter class="object">
                     <Description type="string"></Description>
                     <Label type="string">param_float</Label>
                     <NoEcho type="string">false</NoEcho>
                     <ParameterKey type="string">param_float</ParameterKey>
                     <Type type="string">Number</Type>
              </Parameter>
              <Parameter class="object">
                     <Description type="string"></Description>
                     <Label type="string">param_bool</Label>
                     <NoEcho type="string">false</NoEcho>
                     <ParameterKey type="string">param_bool</ParameterKey>
                     <Type type="string">Boolean</Type>
              </Parameter>
              <Parameter class="object">
                     <Description type="string"></Description>
                     <Label type="string">param_json_list</Label>
                     <NoEcho type="string">false</NoEcho>
                     <ParameterKey type="string">param_json_list</ParameterKey>
                     <Type type="string">Json</Type>
              </Parameter>
              <Parameter class="object">
                     <Default class="object">
                            <c class="array"></c>
                     </Default>
                     <Description type="string"></Description>
                     <Label type="string">param_has_default</Label>
                     <NoEcho type="string">false</NoEcho>
                     <ParameterKey type="string">param_has_default</ParameterKey>
                     <Type type="string">Json</Type>
              </Parameter>
              <Parameter class="object">
                     <Description type="string"></Description>
                     <Label type="string">UpdateVersion</Label>
                     <NoEcho type="string">false</NoEcho>
                     <ParameterKey type="string">UpdateVersion</ParameterKey>
                     <Type type="string">Number</Type>
              </Parameter>
              <Parameter class="object">
                     <Description type="string"></Description>
                     <Label type="string">param_str</Label>
                     <NoEcho type="string">false</NoEcho>
                     <ParameterKey type="string">param_str</ParameterKey>
                     <Type type="string">String</Type>
              </Parameter>
              <Parameter class="object">
                     <Description type="string"></Description>
                     <Label type="string">param_list</Label>
                     <NoEcho type="string">false</NoEcho>
                     <ParameterKey type="string">param_list</ParameterKey>
                     <Type type="string">CommaDelimitedList</Type>
              </Parameter>
              <Parameter class="object">
                     <Description type="string"></Description>
                     <Label type="string">param_json_dict</Label>
                     <NoEcho type="string">false</NoEcho>
                     <ParameterKey type="string">param_json_dict</ParameterKey>
                     <Type type="string">Json</Type>
              </Parameter>
       </Parameters>
       <Outputs class="array">
              <Output class="object">
                     <Description type="string">The instance ID of my ECS.</Description>
                     <ParameterKey type="string">instance_id</ParameterKey>
              </Output>
       </Outputs>
       <RequestId type="string">B288A0BE-D927-4888-B0F7-B35EF84B6E6F</RequestId>
</ValidateTemplateResponse>

JSON format

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

{
  "Description" : "No description",
  "Parameters" : [ {
    "Description" : "",
    "Label" : "param_integer",
    "NoEcho" : "false",
    "ParameterKey" : "param_integer",
    "Type" : "Number"
  }, {
    "Description" : "",
    "Label" : "param_float",
    "NoEcho" : "false",
    "ParameterKey" : "param_float",
    "Type" : "Number"
  }, {
    "Description" : "",
    "Label" : "param_bool",
    "NoEcho" : "false",
    "ParameterKey" : "param_bool",
    "Type" : "Boolean"
  }, {
    "Description" : "",
    "Label" : "param_json_list",
    "NoEcho" : "false",
    "ParameterKey" : "param_json_list",
    "Type" : "Json"
  }, {
    "Default" : {
      "c" : [ ]
    },
    "Description" : "",
    "Label" : "param_has_default",
    "NoEcho" : "false",
    "ParameterKey" : "param_has_default",
    "Type" : "Json"
  }, {
    "Description" : "",
    "Label" : "UpdateVersion",
    "NoEcho" : "false",
    "ParameterKey" : "UpdateVersion",
    "Type" : "Number"
  }, {
    "Description" : "",
    "Label" : "param_str",
    "NoEcho" : "false",
    "ParameterKey" : "param_str",
    "Type" : "String"
  }, {
    "Description" : "",
    "Label" : "param_list",
    "NoEcho" : "false",
    "ParameterKey" : "param_list",
    "Type" : "CommaDelimitedList"
  }, {
    "Description" : "",
    "Label" : "param_json_dict",
    "NoEcho" : "false",
    "ParameterKey" : "param_json_dict",
    "Type" : "Json"
  } ],
  "Outputs" : [ {
    "Description" : "The instance ID of my ECS.",
    "OutputKey" : "instance_id"
  } ],
  "RequestId" : "B288A0BE-D927-4888-B0F7-B35EF84B6E6F"
}

Error codes

For a list of error codes, visit the API Error Center.

Error code

Error message

HTTP status code

Description

InvalidTemplate

{reason}.

400

The error message returned because the specified template is invalid. reason indicates the specific reason.