Updated on 2024-07-05 GMT+08:00

Updating an Application

Function

This API is used to update an application.

Calling Method

For details, see Calling APIs.

URI

PUT /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

id

Yes

String

Application ID

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. template: Create an application using a template.

Enumeration values:

  • template

slave_cluster_id

No

String

Custom slave resource pool ID

trigger

No

TaskTriggerVO object

Triggering settings for application deployment

arrange_infos

No

Array of UpdateTaskV2RequestBody objects

Deployment task list

Table 3 TaskTriggerVO

Parameter

Mandatory

Type

Description

trigger_source

No

String

Scenario where a deployment task can be executed. 0: All execution requests can be triggered. 1: 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 UpdateTaskV2RequestBody

Parameter

Mandatory

Type

Description

id

No

String

Deployment task ID

deploy_system

No

String

Deployment system. deployTemplate: Deployment template.

Enumeration values:

  • deployTemplate

template_id

No

String

Template ID

operation_list

No

Array of DeployV2OperationsDO objects

Deployment orchestration list information

Table 5 DeployV2OperationsDO

Parameter

Mandatory

Type

Description

id

No

String

Step ID

name

No

String

Step name

description

No

String

Description

code

No

String

Download URL

params

No

String

Detailed definition of step

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

Created 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

Update an application.

https://{endpoint}/v1/applications

{
  "id" : "e700f15965694253940502911220d76b",
  "name" : "deployenv20230822192953",
  "project_id" : "55837d272adf4eee90319800e2da6961",
  "description" : "Update an application.",
  "trigger" : {
    "trigger_source" : 0,
    "artifact_source_system" : "",
    "artifact_type" : ""
  },
  "slave_cluster_id" : "",
  "create_type" : "template",
  "is_draft" : true,
  "arrange_infos" : [ {
    "id" : "e700f15965694253940502911220d76b",
    "deploy_system" : "deployTemplate",
    "template_id" : "ec939bdf63194aca9fad45b3ba05643e",
    "operation_list" : [ ]
  } ]
}

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.