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

Creating an Application (Recommended)

Function

This API is used to create an application.

Calling Method

For details, see Calling APIs.

URI

POST /v1/applications

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Definition:

Type (or format) of the message body.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

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.

Constraints:

N/A.

Value range:

String. Max. 20,000 characters.

Default value:

N/A.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

Project ID. For details, see Obtaining a Project ID.

Constraints:

N/A.

Value range:

32 characters, including letters and digits.

Default value:

N/A.

name

Yes

String

Definition:

Application name.

Constraints:

N/A.

Value range:

3 to 128 characters, including letters, digits, underscores (_), and hyphens (-).

Default value:

N/A.

description

No

String

Definition:

Application description.

Constraints:

N/A.

Value range:

Max. 1,024 characters.

Default value:

N/A.

group_id

No

String

Definition:

Group ID of an application. If no_grouped is transferred, the application is not grouped.

Constraints:

N/A.

Value range:

32 characters, including letters and digits. no_grouped is also supported.

Default value:

N/A.

is_draft

Yes

Boolean

Definition:

Draft or not.

Constraints:

N/A.

Value range:

  • true: Draft application.

  • false: Non-draft application.

Default value:

N/A.

create_type

Yes

String

Definition:

Creation type.

Constraints:

N/A.

Value range:

  • template: Template creation.

Default value:

N/A.

slave_cluster_id

No

String

Definition:

Slave cluster ID. It is empty by default. When it is empty, the default agent pool is used.

Constraints:

N/A.

Value range:

1 to 32 characters, including letters and digits.

Default value:

N/A.

trigger

No

TaskTriggerVO object

Definition:

Deployment task triggering scenarios.

Constraints:

trigger_source is mandatory when trigger is set.

arrange_infos

No

Array of TaskV2RequestBody objects

Definition:

Deployment application list.

Constraints:

N/A.

Table 3 TaskTriggerVO

Parameter

Mandatory

Type

Description

trigger_source

No

String

Definition:

Scenario where a deployment task can be executed.

Constraints:

N/A.

Value range:

  • 0: All execution requests can be executed.

  • 1: Execution can be triggered only by pipeline.

Default value:

N/A.

artifact_source_system

No

String

Definition:

Pipeline source when a task can be executed only by the pipeline.

Constraints:

N/A.

Value range:

  • Artifact: The source information is from CodeArts Artifact.

Default value:

N/A.

artifact_type

No

String

Definition:

Artifact repository type when a task can be executed only by the pipeline.

Constraints:

N/A.

Value range:

  • generic: Release repository.

  • docker: Docker repository.

Default value:

N/A.

Table 4 TaskV2RequestBody

Parameter

Mandatory

Type

Description

template_id

No

String

Definition:

Deployment template ID.

Constraints:

N/A.

Value range:

32 characters, including letters and digits.

Default value:

N/A.

operation_list

No

Array of DeployV2OperationsDO objects

Definition:

Deployment orchestration list.

Constraints:

N/A.

Table 5 DeployV2OperationsDO

Parameter

Mandatory

Type

Description

id

No

String

Definition:

Action ID.

Constraints:

N/A.

Value range:

Digits only.

Default value:

N/A.

name

No

String

Definition:

Action name.

Constraints:

N/A.

Value range:

1 to 128 characters.

Default value:

N/A.

description

No

String

Definition:

Action description.

Constraints:

N/A.

Value range:

Max. 1,024 characters.

Default value:

N/A.

code

No

String

Definition:

Action download address.

Constraints:

N/A.

Value range:

Max. 102,400 characters.

Default value:

N/A.

params

No

String

Definition:

Detailed definition of actions.

Constraints:

N/A.

Value range:

Max. 204,800 characters.

Default value:

N/A.

entrance

No

String

Definition:

Action entry function.

Constraints:

N/A.

Value range:

Max. 1,024 characters.

Default value:

N/A.

version

No

String

Definition:

Action version.

Constraints:

N/A.

Value range:

Max. 1,024 characters.

Default value:

N/A.

module_id

No

String

Definition:

Action module ID.

Constraints:

N/A.

Value range:

Max. 1,024 characters.

Default value:

N/A.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

status

String

Definition:

Request status (successful or failed).

Value range:

  • success: Successful.

  • error: Failed.

result

AppBaseResponse object

Definition:

Response body for application basic information.

Table 7 AppBaseResponse

Parameter

Type

Description

id

String

Parameter description:

Application ID.

Value range:

The value consists of 32 characters. Letters and digits are allowed.

name

String

Parameter description:

Application name.

Value range:

The value consists of 3-128 characters. Only letters, digits, hyphens (-) and underscores (_) are allowed.

region

String

Parameter description:

Region to which the application belongs.

Value range:

N/A

arrange_infos

Array of TaskBaseBody objects

Parameter description:

Deployment task list.

Table 8 TaskBaseBody

Parameter

Type

Description

id

String

Parameter description:

Deployment application ID.

Value range:

The value consists of 32 characters. Letters and digits are allowed.

Example Requests

This API is used to create an application.

https://{endpoint}/v1/applications

{
  "name" : "testApp",
  "project_id" : "55837d272adf4eee90319800e2da6961",
  "description" : "Create an application using a template.",
  "trigger" : {
    "trigger_source" : 0,
    "artifact_source_system" : "",
    "artifact_type" : ""
  },
  "slave_cluster_id" : "",
  "create_type" : "template",
  "is_draft" : true,
  "arrange_infos" : [ {
    "template_id" : "43b36b4678f743568e1ffebfd7f4ce76",
    "operation_list" : [ {
      "name" : "Application deployment in Kubernetes (CCE cluster) using Manifest",
      "description" : "Deploy an application in a CCE cluster with manifest file defining Kubernetes objects. [View operation guide](https://support.huaweicloud.com/en-us/usermanual-deployman/deployman_hlp_1096.html)",
      "code" : "https://example.com",
      "params" : "[{\"name\":\"datasource\",\"label\":\"Manifest file source\",\"displaySettings\":{\"DevCloud.ControlType\":\"Radio\",\"DevCloud.ControlType.Style\":\"ButtonGroup\",\"DevCloud.ControlType.Radio\":[{\"displayName\":\"CodeArts Artifact\",\"value\":\"1\"},{\"displayName\":\"CodeArts Repo\",\"value\":\"2\"},{\"displayName\":\"obs\",\"value\":\"4\"}],\"DevCloud.ControlType.Default\":{\"displayName\":\"CodeArts Artifact\",\"value\":\"1\",\"icon\":\"img/release.png\"}},\"defaultDisplay\":[{\"displayName\":\"CodeArts Artifact\",\"value\":\"1\"}],\"validation\":{\"pattern\":null,\"patternDescription\":null,\"maxLength\":null,\"dataType\":null,\"isRequired\":true,\"isNotParameter\":true}},{\"name\":\"deployTenant\",\"label\":\"Deployment tenant\",\"displaySettings\":{\"DevCloud.ControlType\":\"Select\",\"DevCloud.ControlType.Style\":null,\"DevCloud.ControlType.Select\":[{\"displayName\":\"Current Tenant\",\"value\":\"local\"},{\"displayName\":\"Other Tenant\",\"value\":\"other\"}],\"DevCloud.ControlType.Default\":{\"displayName\":\"Current Tenant\",\"value\":\"local\"}},\"defaultDisplay\":[{\"displayName\":\"Current Tenant\",\"value\":\"local\"}],\"validation\":{\"pattern\":null,\"patternDescription\":null,\"maxLength\":null,\"dataType\":null,\"isRequired\":true,\"isNotParameter\":true}},{\"name\":\"use_iam_checkbox\",\"displaySettings\":{\"DevCloud.ControlType\":\"Checkbox\",\"DevCloud.ControlType.Style\":null,\"DevCloud.ControlType.Checkbox\":[{\"displayName\":\"IAM Authorization\",\"value\":\"0\"}]},\"defaultDisplay\":[{\"displayName\":\"IAM Authorization\",\"value\":\"0\"}],\"visibleRule\":\"deployTenant=local\",\"validation\":{\"pattern\":null,\"patternDescription\":null,\"maxLength\":null,\"dataType\":null,\"isRequired\":false,\"isNotParameter\":true}},{\"name\":\"javaProbeCheckBox\",\"displaySettings\":{\"DevCloud.ControlType\":\"Checkbox\",\"DevCloud.ControlType.Style\":null,\"DevCloud.ControlType.Checkbox\":[{\"displayName\":\"Configure JAVA Probes\",\"value\":\"0\"}]},\"defaultDisplay\":[{\"displayName\":\"Configure JAVA Probes\",\"value\":\"0\"}],\"visibleRule\":\"not 1=1\",\"validation\":{\"pattern\":null,\"patternDescription\":null,\"maxLength\":null,\"dataType\":null,\"isRequired\":false,\"isNotParameter\":false}},{\"name\":\"controller_enabled_ignore_errors\",\"displaySettings\":{\"DevCloud.ControlType\":\"Checkbox\",\"DevCloud.ControlType.Style\":null,\"DevCloud.ControlType.Checkbox\":[{\"displayName\":\" Continue Upon Failure\",\"value\":\"0\"}]},\"defaultDisplay\":[{\"displayName\":\" Continue Upon Failure\",\"value\":\"0\"}],\"validation\":{\"pattern\":null,\"patternDescription\":null,\"maxLength\":null,\"dataType\":null,\"isRequired\":true,\"isNotParameter\":false}},{\"name\":\"controller_enabled_overtime\",\"label\":\"Timeout\",\"displaySettings\":{\"DevCloud.ControlType\":\"SingleLineText\",\"DevCloud.ControlType.Style\":null},\"defaultValue\":\"10\",\"validation\":{\"pattern\":\"^([1-9]|[1-2][0-9]|30)$\",\"patternDescription\":\" The time unit is minute. Enter an integer from 1 to 30.\",\"maxLength\":null,\"dataType\":null,\"isRequired\":true,\"isNotParameter\":false}},{\"name\":\"controller_enabled\",\"displaySettings\":{\"DevCloud.ControlType\":\"Hidden\",\"DevCloud.ControlType.Style\":null},\"defaultDisplay\":[{\"displayName\":\"Enable\",\"value\":\"1\"}]},{\"name\":\"visibleRule\",\"displaySettings\":{\"DevCloud.ControlType\":\"Hidden\",\"DevCloud.ControlType.Style\":null},\"defaultValue\":\"{\\\"use_iam_checkbox\\\":{\\\"value\\\":true,\\\"condition\\\":\\\"deployTenant=local\\\"},\\\"controller_enabled_overtime\\\":{\\\"value\\\":true},\\\"javaProbeCheckBox\\\":{\\\"value\\\":true,\\\"condition\\\":\\\"not 1=1\\\"},\\\"datasource\\\":{\\\"value\\\":true},\\\"deployTenant\\\":{\\\"value\\\":true},\\\"controller_enabled_ignore_errors\\\":{\\\"value\\\":true}}\"}]",
      "entrance" : "main.yml",
      "version" : "2.3.69",
      "module_id" : "devcloud2018.k8s-cce-manifest-deployment.k8sdeploy-manifest"
    } ]
  } ]
}

Example Responses

Status code: 200

OK: The request is successful.

{
  "result" : {
    "id" : "e700f15965694253940502911220d76b",
    "name" : "testApp",
    "region" : "region-a",
    "is_disable" : false,
    "arrange_infos" : [ {
      "id" : "3ea35372b6db4d58b187e9a7ee9dc349"
    } ]
  },
  "status" : "success"
}

Status Codes

Status Code

Description

200

OK: The request is successful.

Error Codes

See Error Codes.