Help Center> CodeArts Deploy> API Reference> APIs> Environment Management> Importing a Host in the Environment
Updated on 2023-11-28 GMT+08:00

Importing a Host in the Environment

Function

This API is used to import a host in an environment.

URI

POST /v1/applications/{application_id}/environments/{environment_id}/hosts/import

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

application_id

Yes

String

Application ID.

Minimum: 32

Maximum: 32

environment_id

Yes

String

Environment ID.

Minimum: 32

Maximum: 32

Request Parameters

Table 2 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 3 Request body parameters

Parameter

Mandatory

Type

Description

group_id

Yes

String

Host cluster ID.

host_ids

Yes

Array of strings

IDs of the hosts to be imported.

Minimum: 32

Maximum: 32

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

status

String

Response status.

result

Array of strings

IDs of the imported hosts.

Minimum: 32

Maximum: 32

Array Length: 0 - 100

Example Requests

https://{endpoint}/v1/applications/43943381f7764c52baae8e697720873f/environments/666ec038a53c4b9f899823747a7130e8/hosts/import

{
  "group_id" : "4b0cb2f098174d38b0c15645c13eae6f",
  "host_ids" : [ "8e1eb7f010d4442ca150e3a1a5d96d94" ]
}

Example Responses

Status code: 200

OK: The request is successful.

{
  "status" : "success",
  "result" : [ "c5fa45c92c0849229d003d98f52617eb" ]
}

Status Codes

Status Code

Description

200

OK: The request is successful.

Error Codes

See Error Codes.