Updated on 2025-09-08 GMT+08:00

Querying Template List

Function

This API is used to query the pipeline template list.

Calling Method

For details, see Calling APIs.

URI

POST /v5/{tenant_id}/api/pipeline-templates/list

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

tenant_id

Yes

String

Definition:

Tenant ID, that is, domain ID of a user.

Constraints:

N/A

Value range:

The value consists of 32 characters, including only digits and letters.

Default value:

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

language

No

String

Definition:

Template language.

Constraints:

N/A

Value range:

  • Java.

  • Python.

  • Node.js.

  • Go.

  • .NET.

  • cpp.

  • PHP.

  • Other.

  • None.

Default value:

N/A

is_system

No

Boolean

Definition:

Whether the template is a system template.

Constraints:

N/A

Value range:

  • true: The template is a system template.

  • false: The template is not a system template.

Default value:

N/A

name

No

String

Parameter description:

Template name.

Constraints:

None.

Value range:

None.

Default value:

None.

offset

No

Long

Parameter description:

Offset, which is the position where the query starts.

Constraints:

None.

Value range:

The value is no less than 0.

Default value:

The default value is 0.

limit

No

Long

Definition:

Number of records of each query.

Constraints:

N/A

Value range:

The value is no less than 0.

Default value:

10.

sort_key

No

String

Definition:

(Optional) Field for sorting.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

sort_dir

No

String

Definition:

(Optional) Sorting type.

Constraints:

N/A

Value range:

  • asc: by sorting field in ascending order.

  • desc: by sorting field in descending order.

Default value:

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

offset

Integer

Parameter description:

Initial offset.

Value range:

None.

limit

Integer

Parameter description:

Number of queried records.

Value range:

None.

total

Integer

Parameter description:

Total number of records.

Value range:

None.

templates

Array of PipelineTemplateSimpleVO objects

Parameter description:

Pipeline template list, including details about pipeline templates.

Value Range:

N/A.

Table 4 PipelineTemplateSimpleVO

Parameter

Type

Description

id

String

Definition:

Template ID.

Value range:

The value consists of 32 characters, including digits and letters.

name

String

Parameter description:

Template name.

Value range:

None.

icon

String

Parameter description:

Template icon.

Value range:

None.

manifest_version

String

Parameter description:

Version.

Value range:

The default value is 3.0.

language

String

Definition:

Template language.

Value range:

  • Java.

  • Python.

  • Node.js.

  • Go.

  • .NET.

  • cpp.

  • PHP.

  • Other.

  • None.

description

String

Parameter description:

Template description.

Value range:

None.

is_system

Boolean

Definition:

Whether the template is a system template.

Value range:

  • true: The template is a system template.

  • false: The template is not a system template.

region

String

Parameter description:

Template region.

Value range:

None.

domain_id

String

Definition:

ID of the tenant to which the template belongs.

Value range:

The value consists of 32 characters, including digits and letters.

creator_id

String

Definition:

Template creator ID.

Value range:

The value consists of 32 characters, including digits and letters.

creator_name

String

Parameter description:

Template creator name.

Value range:

None.

updater_id

String

Definition:

Template updater ID.

Value range:

The value consists of 32 characters, including digits and letters.

create_time

Integer

Parameter description:

Creation time.

Value range:

None.

update_time

Integer

Parameter description:

Update time.

Value range:

None.

is_collect

Boolean

Definition:

Whether to add the object to favorites.

Value range:

  • true: Add the object to favorites.

  • false: Do not add the object to favorites.

is_show_source

String

Definition:

Whether to display the pipeline source.

Value range:

  • true: The pipeline source is displayed.

  • false: The pipeline source is not displayed.

stages

Array of stages objects

Parameter description:

Stages of template orchestration.

Constraints:

N/A

Table 5 stages

Parameter

Type

Description

name

String

Parameter description:

Stage name.

Value range:

Enter only letters, digits, hyphens (-), underscores (_), commas (,), semicolons (;), colons (:), periods (.), slashes (/), parentheses (), and spaces. The name cannot start or end with a space, and the length is 1128 characters.

sequence

Integer

Parameter description:

Stage sequence.

Value range:

No less than 0.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_msg

String

Parameter description:

Error message.

Value range:

N/A

error_code

String

Parameter description:

Error code.

Value range:

N/A

Example Requests

This API is used to query the pipeline template list.

Set the start offset to 0 and the number to 3.

POST https://{endpoint}/v5/a5f63758220947b7821e70ae2734c01d/api/pipeline-templates/list

{
  "is_system" : "",
  "offset" : 0,
  "limit" : 3,
  "name" : ""
}

Example Responses

Status code: 200

OK

{
  "offset" : 0,
  "limit" : 3,
  "total" : 19,
  "templates" : [ {
    "id" : "e908740fe06e44a28f30c0f3c81b2ad5",
    "name" : "Serverless-maven Compilation and Deployment",
    "icon" : "maven60",
    "manifest_version" : "3.0",
    "language" : "Java",
    "description" : "Serverless-maven compilation and building, packaging, and deployment templates",
    "is_system" : true,
    "region" : "{region}",
    "domain_id" : "system",
    "creator_id" : "system",
    "creator_name" : "system",
    "updater_id" : "e908740fe06e44a28f30c0f3c81b2ad5",
    "create_time" : 1671172288000,
    "update_time" : 1677640980000,
    "is_collect" : true,
    "is_show_source" : null,
    "stages" : [ {
      "name" : "Build and Check",
      "sequence" : 0
    }, {
      "name" : "Deployment and Test",
      "sequence" : 1
    } ]
  }, {
    "id" : "ac3b3b9a6cb64ef6b732c8f8459ab578",
    "name" : "Building a Container Image on a Node",
    "icon" : "npm60",
    "manifest_version" : "3.0",
    "language" : "Node.js",
    "description" : "Use nodes to build container images and push them to SWR for storage.",
    "is_system" : true,
    "region" : "{region}",
    "domain_id" : "system",
    "creator_id" : "system",
    "creator_name" : "system",
    "updater_id" : "ac3b3b9a6cb64ef6b732c8f8459ab578",
    "create_time" : 1671172288000,
    "update_time" : 1677640980000,
    "is_collect" : true,
    "is_show_source" : null,
    "stages" : [ {
      "name" : "Build",
      "sequence" : 0
    } ]
  }, {
    "id" : "8ea4d170ba0d45d9b1b647a9780ebcf8",
    "name" : "Getting Started",
    "icon" : null,
    "manifest_version" : "3.0",
    "language" : "java",
    "description" : "Pipeline Template for Beginners",
    "is_system" : true,
    "region" : "{region}",
    "domain_id" : "system",
    "creator_id" : "system",
    "creator_name" : "system",
    "updater_id" : "ac3b3b9a6cb64ef6b732c8f8459ab578",
    "create_time" : 1680769082000,
    "update_time" : 1680770243000,
    "is_collect" : false,
    "is_show_source" : null,
    "stages" : [ {
      "name" : "Code check",
      "sequence" : 0
    }, {
      "name" : "Build Phase",
      "sequence" : 1
    }, {
      "name" : "Deployment and Release",
      "sequence" : 2
    } ]
  } ]
}

SDK Sample Code

The SDK sample code is as follows.

This API is used to query the pipeline template list.

Set the start offset to 0 and the number to 3.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.codeartspipeline.v2.region.CodeArtsPipelineRegion;
import com.huaweicloud.sdk.codeartspipeline.v2.*;
import com.huaweicloud.sdk.codeartspipeline.v2.model.*;


public class ListPipelineTemplatesSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        CodeArtsPipelineClient client = CodeArtsPipelineClient.newBuilder()
                .withCredential(auth)
                .withRegion(CodeArtsPipelineRegion.valueOf("<YOUR REGION>"))
                .build();
        ListPipelineTemplatesRequest request = new ListPipelineTemplatesRequest();
        request.withTenantId("{tenant_id}");
        ListPipelineTemplatesQuery body = new ListPipelineTemplatesQuery();
        body.withLimit(3L);
        body.withOffset(0L);
        body.withName("");
        body.withIsSystem();
        request.withBody(body);
        try {
            ListPipelineTemplatesResponse response = client.listPipelineTemplates(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

This API is used to query the pipeline template list.

Set the start offset to 0 and the number to 3.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkcodeartspipeline.v2.region.codeartspipeline_region import CodeArtsPipelineRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkcodeartspipeline.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = BasicCredentials(ak, sk)

    client = CodeArtsPipelineClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(CodeArtsPipelineRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListPipelineTemplatesRequest()
        request.tenant_id = "{tenant_id}"
        request.body = ListPipelineTemplatesQuery(
            limit=3,
            offset=0,
            name="",
            is_system=
        )
        response = client.list_pipeline_templates(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

This API is used to query the pipeline template list.

Set the start offset to 0 and the number to 3.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    codeartspipeline "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/codeartspipeline/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        Build()

    client := codeartspipeline.NewCodeArtsPipelineClient(
        codeartspipeline.CodeArtsPipelineClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListPipelineTemplatesRequest{}
	request.TenantId = "{tenant_id}"
	limitListPipelineTemplatesQuery:= int64(3)
	offsetListPipelineTemplatesQuery:= int64(0)
	nameListPipelineTemplatesQuery:= ""
	isSystemListPipelineTemplatesQuery:= 
	request.Body = &model.ListPipelineTemplatesQuery{
		Limit: &limitListPipelineTemplatesQuery,
		Offset: &offsetListPipelineTemplatesQuery,
		Name: &nameListPipelineTemplatesQuery,
		IsSystem: &isSystemListPipelineTemplatesQuery,
	}
	response, err := client.ListPipelineTemplates(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

OK

400

Bad request

401

Unauthorized

403

Forbidden

404

Not Found

Error Codes

See Error Codes.