Help Center> CodeArts Deploy> API Reference> APIs> Application Management> Creating an Application (Recommended)
Updated on 2023-11-28 GMT+08:00

Creating an Application (Recommended)

Function

This API is used to create an application.

URI

POST /v1/applications

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format). Possible values: application/json;charset=utf-8 application/json

Default: application/json;charset=utf-8

Enumeration values:

  • application/json;charset=utf-8

  • application/json

X-Auth-Token

Yes

String

User token. It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Minimum: 0

Maximum: 20000

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

name

Yes

String

Application name.

Minimum: 3

Maximum: 128

description

No

String

Description.

is_draft

Yes

Boolean

Whether the application is in draft status.

create_type

Yes

String

Creation type. There is only one creation type template, that is, creation based on the template.

Enumeration values:

  • template

slave_cluster_id

No

String

Custom slave resource pool ID.

trigger

No

TaskTriggerVO object

Deployment task triggering scenarios.

arrange_infos

No

Array of TaskV2RequestBody objects

Deployment task list information.

Table 3 TaskTriggerVO

Parameter

Mandatory

Type

Description

trigger_source

No

String

Scenario where a deployment task can be executed. 0 indicates that all execution requests can be triggered. 1 indicates that only pipeline can be triggered.

artifact_source_system

No

String

When a task can be triggered only by the pipeline, source information transferred by the pipeline only supports CodeArts Artifact.

artifact_type

No

String

When a task can be triggered only by the pipeline, the artifact type is generic and docker for the pipeline source.

Table 4 TaskV2RequestBody

Parameter

Mandatory

Type

Description

template_id

No

String

Template ID.

operation_list

No

Array of DeployV2OperationsDO objects

Deployment orchestration list information.

Table 5 DeployV2OperationsDO

Parameter

Mandatory

Type

Description

name

No

String

Step name.

description

No

String

Step description.

code

No

String

Download URL.

params

No

String

Parameter.

entrance

No

String

Entry function.

version

No

String

Version.

module_id

No

String

Module ID.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

status

String

Request success or failure status.

result

AppBaseResponse object

Response body for creating or deleting an application

Table 7 AppBaseResponse

Parameter

Type

Description

id

String

Created application ID.

name

String

This API is used to create an application name.

region

String

Region to which the application belongs.

arrange_infos

Array of TaskBaseBody objects

Deployment task list.

Table 8 TaskBaseBody

Parameter

Type

Description

id

String

Created deployment task ID.

Example Requests

This API is used to create an application.

https://{endpoint}/v1/applications

{
  "name" : "deployenv20230822192953",
  "project_id" : "55837d272adf4eee90319800e2da6961",
  "description" : "This API is used to create an application using a blank template.",
  "trigger" : {
    "trigger_source" : 0,
    "artifact_source_system" : "",
    "artifact_type" : ""
  },
  "slave_cluster_id" : "",
  "create_type" : "template",
  "is_draft" : true,
  "arrange_infos" : [ ]
}

Example Responses

Status code: 200

OK: The request is successful.

{
  "result" : {
    "id" : "e700f15965694253940502911220d76b",
    "name" : "testApp",
    "region" : "cn-north-7",
    "arrange_infos" : [ {
      "id" : "e700f15965694253940502911220d76b"
    } ]
  },
  "status" : "success"
}

Status Codes

Status Code

Description

200

OK: The request is successful.

Error Codes

See Error Codes.