All Products
Search
Document Center

Resource Orchestration Service:UpdateTemplate

Last Updated:Mar 05, 2025
This topic is generated by a machine translation engine without any human intervention. ALIBABA CLOUD DOES NOT GUARANTEE THE ACCURACY OF MACHINE TRANSLATED CONTENT. To request a human-translated version of this topic or provide feedback on this translation, please include it in the feedback form.

Update Template

Operation description

When updating a template, please note:

  • If you specify TemplateBody or TemplateURL, the template version will be incremented by 1 after a successful update. For example, the version changes from v1 to v2.
  • If neither TemplateBody nor TemplateURL is specified, the template version remains unchanged.
  • A template can have up to 100 versions. If the version limit is reached, the template update will fail, and you need to recreate the template.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ros:UpdateTemplateupdate
*template
acs:ros:{#regionId}:{#accountId}:template/{#templateId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TemplateURLstringNo

The location of the file containing the template body. The URL must point to a template located on a web server (HTTP or HTTPS) or in an Alibaba Cloud OSS bucket (e.g., oss://ros/template/demo, oss://ros/template/demo?RegionId=cn-hangzhou), with a maximum size of 524,288 bytes.

Note If the OSS region is not specified, it defaults to the same as the RegionId parameter in the request.

You can only specify one of TemplateBody or TemplateURL.
The maximum length of the URL is 1,024 bytes.

oss://ros/template/demo
TemplateNamestringNo

The name of the template.
The length should not exceed 255 characters (utf-8 encoding), and it must start with a number, letter, or Chinese character. It can include numbers, letters, Chinese characters, hyphens (-), and underscores (_).

MyTemplate
DescriptionstringNo

The description of the template. The maximum length is 256 characters.

It is a demo.
TemplateBodystringNo

The structure of the template body. The length should be between 1 and 524,288 bytes. If the content is long, it is recommended to use HTTP POST + Body Param to pass the parameter in the request body to avoid request failure due to an overly long URL.

Note You must and can only specify one of TemplateBody, TemplateURL, TemplateId, or TemplateScratchId.
{"ROSTemplateFormatVersion":"2015-09-01"}
TemplateIdstringYes

The template ID. Supports both shared and private templates.

5ecd1e10-b0e9-4389-a565-e4c15efc****
ValidationOptionsarrayNo

Validation options.

By default, no options are enabled, and strict validation is performed.

stringNo

Validation options. Values:

  • BasicValidation: Only performs basic structural validation on the template content.
BasicValidation
RotateStrategystringNo

Template version rotation strategy. Values:

  • None (default): No rotation. An error occurs when the version limit is reached.
  • DeleteOldestNonSharedVersionWhenLimitExceeded: Rotates and deletes non-shared template versions.
Note
  • If all versions of the template are shared, they cannot be rotated and deleted.
  • The current latest version will not be rotated and deleted.
  • Regardless of whether rotation deletion is used, the template version number cannot exceed v65000.
  • None
    IsDraftbooleanNo

    Whether to update the Draft (draft) version. Values:

    • false (default): If template content is provided, a new version is created, and the Draft version is cleared. Otherwise, the current latest version is modified.
    • true: Modifies the Draft version. The Draft version can only be retrieved via the GetTemplate interface. The ListTemplateVersions interface will not return it. The TemplateVersion parameter in other interfaces cannot specify Draft.
    false

    For details on common request parameters, see Common Parameters.

    Response parameters

    ParameterTypeDescriptionExample
    object
    RequestIdstring

    Request ID.

    8C5D90E1-66B6-496C-9371-3807F8DA80A8
    TemplateIdstring

    Template ID.

    5ecd1e10-b0e9-4389-a565-e4c15efc****
    TemplateVersionstring

    The template version affected by this operation.

    v2

    Examples

    Sample success responses

    JSONformat

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

    Error codes

    For a list of error codes, visit the Service error codes.

    Change history

    Change timeSummary of changesOperation
    2024-08-08The response structure of the API has changedView Change Details
    2024-08-01The request parameters of the API has changedView Change Details
    2024-01-12The internal configuration of the API is changed, but the call is not affectedView Change Details
    HttpCode错误码错误信息描述
    404TemplateNotFoundThe Tempalte ({ ID }) could not be found.模板不存在。
    400InvalidSchema{reason}.模板格式不正确。reason 为具体原因。
    400InvalidTemplateAttributeThe Referenced Attribute ({resource} {name}) is incorrect.模板包含不正确的资源属性(输出)引用。resource 为资源名,name 为属性名。
    400InvalidTemplatePropertyTypeThe specified value type of ({resource} {section}) is incorrect.模板资源定义中的字段类型不正确。resource 为资源名,section 为字段名。
    400InvalidTemplateReferenceThe specified reference "{name}" (in {referencer}) is incorrect.模板包含不正确的引用。name 为引用名,referencer 为引用者。
    400InvalidTemplateSectionThe template section is invalid: {section}.模板包含无效的字段。section 为字段名。
    400InvalidTemplateVersionThe template version is invalid: {reason}.模板版本不正确。reason 为具体原因。
    400TemplateBeingProcessedTemplate { ID } is being processed, retry later.模板正在处理中,稍后再试。ID 为模板 ID。