You can call this operation to create a template.

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 CreateTemplate

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

TemplateName String Yes MyTemplate

The name of the template. The name can be up to 255 characters in length and can contain digits, letters, hyphens (-), and underscores (_). It must start with a digit or letter.

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

The structure that contains the template body. The template body must be 1 to 51,200 bytes in length. You must specify either the TemplateBody parameter or the TemplateURL parameter, but you cannot specify both of them.

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

The URL of the file that contains the template body. The URL must point to a template that is located in an HTTP or HTTPS web server or an Alibaba Cloud OSS bucket. For example, oss://ros/template/demo. The template can be up to 524,288 bytes in length. You must specify either the TemplateBody parameter or the TemplateURL parameter, but you cannot specify both of them.

Description String No It is a demo.

The description of the template. The description can be up to 256 characters in length.

Response parameters

Parameter Type Example Description
RequestId String 8C5D90E1-66B6-496C-9371-3807F8DA80A8

The ID of the request.

TemplateId String 5ecd1e10-b0e9-4389-a565-e4c15efc****

The ID of the template.

Examples

Sample requests


http(s)://[Endpoint]/? Action=CreateTemplate
&TemplateName=MyTemplate
&<Common request parameters>

Sample success responses

XML format

<RequestId>8C5D90E1-66B6-496C-9371-3807F8DA80A8</RequestId>
<TemplateId>5ecd1e10-b0e9-4389-a565-e4c15efc****</TemplateId>

JSON format

{
	"RequestId":"8C5D90E1-66B6-496C-9371-3807F8DA80A8",
	"TemplateId":"5ecd1e10-b0e9-4389-a565-e4c15efc****"
}

Error codes

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

For a list of error codes common to all operations, see Common error codes.

Error code

Error message

HTTP status code

Description

InvalidSchema

{reason}.

400

The error message returned because the template format is incorrect. reason indicates the specific reason.

InvalidTemplateAttribute

The Referenced Attribute ({resource} {name}) is incorrect.

400

The error message returned because the resource attribute referenced in the template is incorrect. resource indicates the resource name, and name indicates the attribute name.

InvalidTemplatePropertyType

The specified value type of ({resource} {section}) is incorrect.

400

The error message returned because the type of the resource property defined in the template is incorrect. resource indicates the resource name, and section indicates the property name.

InvalidTemplateReference

The specified reference "{name}" (in {referencer}) is incorrect.

400

The error message returned because the template contains an invalid reference. name indicates the reference name, and referencer indicates the referencer name.

InvalidTemplateSection

The template section is invalid: {section}.

400

The error message returned because the template contains an invalid property. section indicates the property name.

InvalidTemplateVersion

The template version is invalid: {reason}.

400

The error message returned because the template version is incorrect. reason indicates the specific reason.