You can call this operation to query templates with multiple filtering methods.
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateTemplate | The operation that you want to perform. Set this parameter to ListTemplates. |
TemplateName | String | No | MyTemplate | The name of the template. A template is returned if its name contains the string specified for this parameter. |
TemplateFormat | String | No | YAML | The format of the template. Valid values: - JSON - YAML |
ShareType | String | No | Public | The sharing type of the template. Valid values: - Public - Private |
CreatedBy | String | No | ACS | The creator of the template. - For the templates provided by Alibaba Cloud, the creator is ACS. - For user-defined templates, you can specify a UID or username. |
CreatedDateBefore | String | No | 2019-05-16T10:26:14Z | Specifies a time so that only templates that are created before the specified time are returned. The timestamp format is YYYY-MM-DDThh:mm:ssZ. |
CreatedDateAfter | String | No | 2019-05-16T10:26:14Z | Specifies a time so that only templates that are created after the specified time are returned. The timestamp format is YYYY-MM-DDThh:mm:ssZ. |
MaxResults | Integer | No | 50 | The maximum number of templates on each page. Valid values: 20 to 100. Default value: 50. |
NextToken | String | No | - | The token that is required to retrieve the next page of results. |
SortField | String | No | Popularity | The field by which the templates are sorted. Valid values: - TotalExecutionCount - Popularity - TemplateName - CreatedDate Default value: TotalExecutionCount. |
SortOrder | String | No | Descending | The order that the templates are sorted. Valid values: - Ascending - Descending Default value: Descending. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | BEFA-17B6-449F-A219-49ACA1B157E3 | The ID of the request. |
Templates | List | - | The metadata of the template. |
└ CreatedBy | String | root(1309200) | The creator of the template. |
└ CreatedDate | String | 2019-05-16T10:26:14Z | The time when the template is created. |
└ UpdatedBy | String | root(13092000) | The person who updates the template. |
└ UpdatedDate | String | 2019-05-16T10:26:14Z | The update time of the template. |
└ Description | String | Describe instances of given status | The description of the template. |
└ Hash | String | 4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4 | The SHA256 hash of the template content. |
└ ShareType | String | Private | The sharing type of the template. The sharing type of templates created by users are set to Private. The sharing type of common templates provided by OOS are set to Public. |
└ TemplateFormat | String | JSON | The format of the template. The format can be JSON or YAML. The system automatically identifies the format. |
└ TemplateName | String | MyTemplate | The name of the template. |
└ TemplateVersion | String | v1 | The version of the template. The format is the letter v and a number. The number starts from 1. |
└ TotalExecutionCount | Integer | 5 | The total number of executions of the private templates. This field is only applicable when ShareType is Private. If ShareType is Public, the value of this field is -1. |
└ Popularity | Integer | 8 | The popularity of the common templates. Valid values: 1 to 10. A higher number indicates higher popularity. This field is only applicable when ShareType is Public. If ShareType is Private, the value of this field is -1. |
Examples
Sample request
https://oos.cn-hangzhou.aliyuncs.com/?Action=ListTemplates
&<Common request parameters>
Sample success response JSON
format
{
"MaxResults": 50,
"RequestId": "BEF54BA-17B6-449F-A219-49ACB157E3",
"Templates": [
{
"CreatedBy": "root(13090000)",
"CreatedDate": "2019-05-14T09:16:37Z",
"UpdatedBy": "root(130900000)",
"UpdatedDate": "2019-05-27T08:46:33Z",
"Description": "",
"Hash": "d02b84917e5a82c672630bf041a61dd5dc52fbc481ff98516c6a81876f3d9c01",
"ShareType": "Private",
"TemplateFormat": "JSON",
"TemplateName": "MyTemplate",
"TemplateId": "t-94753dd828d38",
"TemplateVersion": "v1",
"TotalExecutionCount": 0,
"Popularity": -1
}, ... ]
}
Error codes
Error code | HTTP status code | Error message | Description |
---|---|---|---|
InvalidVersion | 400 | Specified parameter Version is not valid. | The error message returned because the specified version is invalid. Specify a valid version in the URL and try again. |
InvalidAction.NotFound | 400 | Specified api is not found, please check your url and method. | The error message returned because the specified operation does not exist. Enter the correct Action in the URL. |
Throttling.User | 400 | Your request was denied due to instance flow control. | The error message returned because too many requests have been sent over a short period of time. Try again later. |
User.NoPermission | 401 | User has no permission to do the action: ({api_name}) | The error message returned because the user does not have the permission to call this operation. Check whether the current user has the permission to call the OOS API in the RAM console. |
InvalidStsToken | 400 | Invalid STS token to do the action: ({api_name}) | The error message returned because the specified STS token is invalid. |
ExpiredStsToken | 400 | Expired STS token to do the action: ({api_name}) | The error message returned because the specified STS token has expired. |
InvalidAccountType | 400 | The account type ({account_type}) was not supported. | The error message returned because the specified account type is not supported. |
InvalidNextToken | 400 | The NextToken is invalid. | The error message returned because the NextToken is invalid. Enter a valid token and try again. |
InvalidNextTokenQuery | 400 | Query parameters changed for the next token | The error message returned because the parameter settings used in the current request with NextToken specified are different from the parameter settings used in the first request. |