Obtaining a Template List
Function
This API is used to obtain a template list based on the parameters provided.
URI
GET /v2.1/templates
Parameter |
Mandatory |
Description |
---|---|---|
name |
No |
Template name. This parameter is applicable to scenarios where the template ID is queried based on the template name. |
offset |
No |
Start offset. The default value is 0. |
limit |
No |
Total number of queries. This parameter can be set only when offset is set. |
dsl_version |
No |
DSL version of the template. |
check_used |
No |
Template usage condition. If this parameter is left blank, false is used by default. |
include_stack |
No |
If this parameter is set to true, solution templates are queried. If this parameter is set to false, common templates are queried. If this parameter is left blank, all templates are queried. |
Request
N/A
Response
- Response parameters
For details about response parameters when the request fails, see Table 5.
Table 2 Response parameters Parameter
Type
Description
templates
Array of objects
Array elements contain detailed information about all versions of each template. For details, see Table 3.
total
Integer
Total number of templates
Table 3 Data structure of the templates field Parameter
Type
Description
template
Array of objects
Array elements are template details. For details, see Table 4.
Table 4 Data structure of the template field Parameter
Type
Description
id
String
Template ID.
name
String
Template name.
version
String
Template version.
vendor
String
Template publisher.
description
String
Template description.
template_url
String
URL where the template package is stored.
create_at
String
Template creation time.
update_at
String
Template update time.
scope
String
Template application scope.
- project: available within a project (Currently, templates of this scope cannot be created anymore.)
- domain: available within an account
- public: available globally, namely, available between accounts
domain
String
Name of the account to which the template belongs.
need_clutser
Boolean
Determine whether Cloud Container Engine (CCE) clusters are required. Currently, all AOS applications must be deployed on CCE clusters.
dsl_version
String
DSL version of the template.
is_new_template
Boolean
Whether it is a new template.
include_stack
Boolean
Whether the template contains stack elements (AOS.Stack).
is_used
Boolean
Check whether the template is in use (that is, check whether there are any stack created using this template). If the value of this parameter is true, the template is in use.
Table 5 Response header Parameter
Mandatory
Type
Value Range
Description
Content-Range
No
String
The value depends on the number of templates.
Example: items 0-24/66
Pagination information. The values of items include the start number, end number, and total number.
- Example response
{ "templates": [ { "template": [ { "id": "74252143-4ca1-7ddb-d585-6be6786d1209", "name": "api-test", "version": "1.0", "vendor": "paas_aos_w00417971", "description": "", "template_url": "", "create_at": "2020-07-10T07:29:25Z", "update_at": "2020-07-14T11:07:09Z", "scope": "domain", "domain": "paas_aos_w00417971", "need_cluster": false, "dsl_version": "", "include_stack": false, "is_new_template": false, "is_used": false }, { "id": "34b159d8-cdf2-6764-e97b-8eb45b8e0f5b", "name": "api-test", "version": "1.1", "vendor": "paas_aos_w00417971", "description": "", "template_url": "", "create_at": "2020-07-14T11:05:36Z", "update_at": "2020-07-14T11:05:36Z", "scope": "domain", "domain": "paas_aos_w00417971", "need_cluster": false, "dsl_version": "", "include_stack": false, "is_new_template": false, "is_used": false } ] }, "total": 2 }
Status Code
- Normal
Table 6 Status code Status Code
Description
200
The template list query succeeds.
- Abnormal
Table 7 Status code Status Code
Description
500
The server encountered an unexpected condition which prevented it from fulfilling the request.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.