You can call this operation to share or unshare a template.
In this example, a template whose ID is 5ecd1e10-b0e9-4389-a565-e4c15efc****
is shared with an Alibaba Cloud account whose ID is 151266687691****
.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | SetTemplatePermission |
The operation that you want to perform. Set the value to SetTemplatePermission. |
AccountIds.N | RepeatList | Yes | 151266687691**** |
The list of one or more Alibaba Cloud accounts with which you want to share or unshare the template. Valid values of N: 1 to 5. Note
|
ShareOption | String | Yes | ShareToAccounts |
The sharing option. Valid values:
|
TemplateId | String | Yes | 5ecd1e10-b0e9-4389-a565-e4c15efc**** |
The ID of the template. |
VersionOption | String | No | Specified |
The version option for template sharing. This parameter takes effect when the ShareOption parameter is set to ShareToAccounts. Default value: AllVersions. Valid values:
|
TemplateVersion | String | No | v1 |
The version of the template that you want to share. This parameter takes effect when the ShareOption parameter is set to ShareToAccounts and the VersionOption parameter is set to Specified. Valid values: v1 to v100. |
For more information about common parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | B288A0BE-D927-4888-B0F7-B35EF84B6E6F |
The ID of the request. |
Examples
Sample requests
http(s)://ros.aliyuncs.com/? Action=SetTemplatePermission
&AccountIds.1=151266687691****
&ShareOption=ShareToAccounts
&TemplateId=5ecd1e10-b0e9-4389-a565-e4c15efc****
&<Common request parameters>
Sample success responses
XML
format
<SetTemplatePermissionResponse>
<RequestId>B288A0BE-D927-4888-B0F7-B35EF84B6E6F</RequestId>
</SetTemplatePermissionResponse>
JSON
format
{
"RequestId":"B288A0BE-D927-4888-B0F7-B35EF84B6E6F"
}
Error codes
For a list of error codes, visit the API Error Center.
HTTP status code |
Error code |
Error message |
Description |
---|---|---|---|
400 |
TemplateBeingProcessed |
Template { ID } is being processed, retry later. |
The error message returned because the specified template has an action in progress. Try again later. ID indicates the template ID. |
404 |
TemplateNotFound |
The Tempalte ({ ID }) could not be found. |
The error message returned because the specified template does not exist. ID indicates the template ID. |
404 |
TemplateNotFound |
The Template { ID } with version { version } could not be found. |
The error message returned because the specified template or version does not exist. ID indicates the template ID, and version indicates the template version. |