Updates a template by specifying the template URL or template details.
Operation description
When you update a template, take note of the following items:
- If you specify TemplateBody or TemplateURL, the existing version number is automatically incremented by 1 after the template is updated. For example, the version is changed from v1 to v2.
- If you do not specify TemplateBody or TemplateURL, the version number remains unchanged.
- A template can have up to 100 versions. If the number of templates reaches the upper limit, the template fails to be updated. You must create another template.
Debugging
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:
- The required resource types are displayed in bold characters.
- 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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ros:UpdateTemplate | update |
|
| none |
Request syntax
POST /V2/UpdateTemplate
GET /V2/UpdateTemplate
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
TemplateURL | string | No | 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 Alibaba Cloud 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, and the URL can be up to 1,024 bytes in length. Note
If the region of the OSS bucket is not specified, the RegionId value is used.
You can specify only one of the TemplateBody and TemplateURL parameters. | oss://ros/template/demo |
TemplateName | string | No | 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. | MyTemplate |
Description | string | No | The description of the template. It can be up to 256 characters in length. | It is a demo. |
TemplateBody | string | No | 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 can specify only one of the TemplateBody and TemplateURL parameters. | {"ROSTemplateFormatVersion":"2015-09-01"} |
TemplateId | string | Yes | The ID of the template. This parameter applies to shared and private templates. | 5ecd1e10-b0e9-4389-a565-e4c15efc**** |
For more information about common request parameters, see Common parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "8C5D90E1-66B6-496C-9371-3807F8DA80A8",
"TemplateId": "5ecd1e10-b0e9-4389-a565-e4c15efc****"
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-08-08 | The response structure of the API has changed | View Change Details |
2024-08-01 | The request parameters of the API has changed | View Change Details |
2024-01-12 | The internal configuration of the API is changed, but the call is not affected | View Change Details |