Updated on 2026-01-12 GMT+08:00

Creating a Pipeline Template

Function

This API is used to create a pipeline template.

Calling Method

For details, see Calling APIs.

URI

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

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 header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition:

User token. Obtain a token (the value of the X-Subject-Token response header) by calling the IAM API for .

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition:

Template name.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

description

No

String

Definition:

Template description.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

language

Yes

String

Definition:

Template language.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

variables

No

Array of CustomVariableVO objects

Definition:

Custom parameter.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

definition

Yes

String

Definition:

Template orchestration JSON file, including stages.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

is_system

Yes

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

domain_id

Yes

String

Definition:

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

Constraints:

N/A

Range:

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

Default value:

N/A

is_show_source

Yes

Boolean

Definition:

Whether to display the pipeline source.

Constraints:

N/A

Value range:

  • true: Display the pipeline source.

  • false: Do not display the pipeline source.

Default value:

N/A

Table 4 CustomVariableVO

Parameter

Mandatory

Type

Description

name

No

String

Definition:

Custom parameter name.

Constraints:

N/A.

Value range:

Enter a maximum of 128 characters. Only letters, digits, and underscores (_) are supported.

Default value:

N/A.

sequence

No

Integer

Definition:

Parameter sequence number, which starts from 1.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

type

No

String

Definition:

Custom parameter type.

Constraints:

N/A.

Value range:

  • autoIncrement: auto-increment parameter.

  • enum: enumerated parameter.

  • string: string parameter.

Default value:

N/A.

value

No

String

Definition:

Default value of a custom parameter.

Constraints:

N/A.

Value range:

Max. 8,192 characters.

Default value:

N/A.

is_secret

No

Boolean

Definition:

Private parameter or not.

Constraints:

N/A.

Value range:

  • true: The parameter is private.

  • false: The parameter is not private.

Default value:

false.

description

No

String

Definition:

Parameter description.

Constraints:

N/A.

Value range:

Max. 1,024 characters.

Default value:

N/A.

is_runtime

No

Boolean

Definition:

Whether a parameter can be set at runtime.

Constraints:

N/A.

Value range:

  • true: The parameter can be set at runtime.

  • false: The parameter cannot be set at runtime.

Default value:

false.

limits

No

Array of objects

Definition:

Enumerated values.

Constraints:

N/A.

Value range:

Max. 1,024 characters for an enumerated value.

Default value:

N/A.

is_reset

No

Boolean

Definition:

Whether to reset. If the auto-increment parameter is edited, the edited value is used. Otherwise, the last digit increases.

Constraints:

N/A.

Value range:

  • true: Use the edited parameter value.

  • false: Use the auto-increment parameter.

Default value:

false.

latest_value

No

String

Definition:

Value of the parameter in the last run.

Constraints:

N/A.

Value range:

Max. 8,192 characters.

Default value:

N/A.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

templateId

String

Definition:

Template ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

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

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

{
  "name" : "Creating a Pipeline Template-20231023215133",
  "description" : "",
  "language" : "none",
  "is_show_source" : true,
  "variables" : [ ],
  "definition" : "{\"stages\":[{\"name\":\"Stage_1\",\"sequence\":\"0\",\"jobs\":[{\"stage_id\":1698069093677,\"identifier\":\"16980691185419778b0f5-02cd-4bd3-a8cc-da825644add1\",\"name\":\"CodeCheck\",\"depends_on\":[],\"timeout\":\"\",\"timeout_unit\":\"\",\"steps\":[{\"name\":\"CodeCheck\",\"task\":\"official_devcloud_codeCheck_template\",\"sequence\":0,\"inputs\":[{\"key\":\"language\",\"value\":\"Java\"},{\"key\":\"module_or_template_id\",\"value\":\"d7dffaefb6d94c63a09cf141668356c7\"}],\"business_type\":\"Gate\",\"runtime_attribution\":\"agent\",\"identifier\":\"16980691136015f94b249-102d-44f2-abb5-02fa3ad9fae0\",\"multi_step_editable\":0,\"official_task_version\":\"0.0.1\"}],\"resource\":\"{\\\"type\\\":\\\"system\\\",\\\"arch\\\":\\\"x86\\\"}\",\"condition\":\"${{ completed() }}\",\"exec_type\":\"OCTOPUS_JOB\",\"sequence\":0}],\"identifier\":\"16980690936778259e2a5-a97e-4c66-af8d-1908988c1c21\",\"pre\":[{\"task\":\"official_devcloud_autoTrigger\",\"sequence\":0}],\"post\":null,\"depends_on\":[],\"run_always\":false}]}",
  "domain_id" : "ce8df55870164338a72d7e828a966a2a",
  "is_system" : false
}

Example Responses

Status code: 200

OK

{
  "templateId" : "ad8a26f8b19a4b83a8d92eb733b65476"
}

Status Codes

Status Code

Description

200

OK

400

Bad request

401

Unauthorized

403

Forbidden

404

Not Found

Error Codes

See Error Codes.