All Products
Search
Document Center

Operation Orchestration Service:ListTemplates

Last Updated:Oct 28, 2022

Queries templates. Multiple methods are supported to filter templates.

Authorization information

The following table is the authorization information corresponding to the API, which can be found in the RAM permission policy statement.Action Used in the element to grant the RAM user or RAM role permission to call this API. The specific instructions are as follows:

  • 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 keyword: refers to the condition keyword defined by the cloud product itself.
  • 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.
Operateaccess levelResource typeconditional keywordAssociation operation
oos:ListTemplatesREAD
  • OOS
    acs:oos:{#regionId}:{#accountId}:template/*
  • OOS
    acs:oos:{#regionId}:{#accountId}:template/{#templateName}
  • oos:tag
without

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringNo

The ID of the region in which you want to query templates.

cn-hangzhou
TemplateNamestringNo

The name of the template. All templates whose names contain the specified template name are to be returned.

MyTemplate
TemplateFormatstringNo

The format of the template. Valid values:

  • JSON
  • YAML
YAML
ShareTypestringNo

The share type of the template. Valid values:

  • Public
  • Private
Private
CreatedBystringNo

The creator of the template.

  • To query the template provided by Alibaba Cloud, set this parameter to ACS.
  • To query the template created by a user, set this parameter to the ID of the template or the name of the user who creates the template.
ACS
CreatedDateBeforestringNo

Specifies to query the template that is created at or before the specified time.

The value must be in the YYYY-MM-DDThh:mm::ssZ format.

2019-05-16T10:26:14Z
CreatedDateAfterstringNo

Specifies to query the template that is created at or later than the specified time.

The value must be in the YYYY-MM-DDThh:mm:ssZ format.

2019-05-16T10:26:14Z
TagsobjectNo

The tag keys and values. The number of key-value pairs ranges from 1 to 20.

CategorystringNo

The type of the template. Valid values include TimerTrigger, EventTrigger, AlarmTrigger, and Other.

TimerTrigger
MaxResultsintegerNo

The number of entries to return on each page. Valid values: 20 to 100. Default value: 50.

50
NextTokenstringNo

The token that is used to retrieve the next page of results.

xxx
SortFieldstringNo

The field that is used to sort the templates to be returned. Valid values:

  • TotalExecutionCounts: The system sorts the returned templates based on the total number of execution times of the template. This is the default value.
  • Popularity: The system sorts the returned templates based on the popularity of the template.
  • TemplateName: The system sorts the returned templates based on the name of the template.
  • CreatedDate: The system sorts the returned templates based on the creation time of the template.
Popularity
SortOrderstringNo

The order in which you want to sort the results. Valid values:

  • Ascending: ascending order.
  • Descending: descending order. This is the default value.
Descending
HasTriggerbooleanNo

Specifies whether to query the template that is configured with a trigger.

true
TemplateTypestringNo

The type of the template.

private
ResourceGroupIdstringNo

The ID of the resource group.

rg-acfmxsn4m4******

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

The token that is used to retrieve the next page of results.

xxx
RequestIdstring

The ID of the request.

BEF54BA-17B6-449F-A219-49ACB157E3
MaxResultsinteger

The number of entries returned on each page.

50
Templatesarray

The metadata of the template.

object
Hashstring

The SHA-256 value of the template content.

4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4
UpdatedDatestring

The time when the template was last updated.

2019-05-16T10:26:14Z
UpdatedBystring

The user who last updated the template.

root(13092000)
TemplateTypestring

The type of the template.

private
Tagsobject

The tag keys and values. The number of key-value pairs ranges from 1 to 20.

TemplateNamestring

The name of the template.

MyTemplate
TemplateVersionstring

The version of the template. The name of the version consists of the letter v and a number. The number starts from 1.

v1
TemplateFormatstring

The format of the template. The system automatically determines whether the format is JSON or YAML.

JSON
Popularityinteger

The popularity of the public template. Valid values: 1-10. A greater value indicates higher popularity. If the ShareType parameter is set to Private, the value of this parameter is -1.

**

NotesThis parameter is valid only if the value of the ShareType parameter is set to Public.

8
TotalExecutionCountinteger

The number of times for which the private template is executed. If the ShareType parameter is set to Public, the value of this parameter is -1.

**

NotesThis parameter is valid only if the ShareType parameter is set to Private.

5
Descriptionstring

The description of the template.

Describe instances of given status
ResourceGroupIdstring

The ID of the resource group.

rg-acfmxsn4m4******
CreatedBystring

The user who created the template.

root(1309200)
CreatedDatestring

The time when the template was created.

2019-05-16T10:26:14Z
Categorystring

The type of the template.

TimerTrigger
HasTriggerboolean

Indicates whether the template is configured with a trigger.

true
TemplateIdstring

The ID of the template.

t-94753deed38
ShareTypestring

The share type of the template. The share type of the template that you create is Private. Valid values:

  • Public
  • Private
Public

Example

Normal return example

JSONFormat

{
    "NextToken": "xxx",
    "RequestId": "BEF54BA-17B6-449F-A219-49ACB157E3",
    "MaxResults": 50,
    "Templates": [
        {
            "Hash": "4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4",
            "UpdatedDate": "2019-05-16T10:26:14Z",
            "UpdatedBy": "root(13092000)",
            "TemplateType": "private",
            "TemplateName": "MyTemplate",
            "TemplateVersion": "v1",
            "TemplateFormat": "JSON",
            "Popularity": 8,
            "TotalExecutionCount": 5,
            "Description": "Describe instances of given status",
            "ResourceGroupId": "rg-acfmxsn4m4******",
            "CreatedBy": "root(1309200)",
            "CreatedDate": "2019-05-16T10:26:14Z",
            "Category": "TimerTrigger",
            "HasTrigger": true,
            "TemplateId": "t-94753deed38",
            "ShareType": "Public"
        }
    ]
}

XMLFormat

<ListTemplatesResponse>
    <NextToken>xxx</NextToken>
    <RequestId>BEF54BA-17B6-449F-A219-49ACB157E3</RequestId>
    <MaxResults>50</MaxResults>
    <Templates>
        <Hash>4bc7d7a21b3e003434b9c223f6e6d2578b5ebfeb5be28c1fcf8a8a1b11907bb4</Hash>
        <UpdatedDate>2019-05-16T10:26:14Z</UpdatedDate>
        <UpdatedBy>root(13092000)</UpdatedBy>
        <TemplateType>private</TemplateType>
        <TemplateName>MyTemplate</TemplateName>
        <TemplateVersion>v1</TemplateVersion>
        <TemplateFormat>JSON</TemplateFormat>
        <Popularity>8</Popularity>
        <TotalExecutionCount>5</TotalExecutionCount>
        <Description>Describe instances of given status</Description>
        <ResourceGroupId>rg-acfmxsn4m4******</ResourceGroupId>
        <CreatedBy>root(1309200)</CreatedBy>
        <CreatedDate>2019-05-16T10:26:14Z</CreatedDate>
        <Category>TimerTrigger</Category>
        <HasTrigger>true</HasTrigger>
        <TemplateId>t-94753deed38</TemplateId>
        <ShareType>Public</ShareType>
    </Templates>
</ListTemplatesResponse>

Error codes

For a list of error codes, visit the API error center.