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

Importing a Host to an Environment

Function

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

Calling Method

For details, see Calling APIs.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

application_id

Yes

String

Definition:

Application ID.

Constraints:

N/A.

Value range:

32 characters, including letters and digits.

Default value:

N/A.

environment_id

Yes

String

Definition:

Environment ID.

Constraints:

N/A.

Value range:

32 characters, including letters and digits.

Default value:

N/A.

Request Parameters

Table 2 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 used for.

Constraints:

N/A.

Value range:

String. Max. 20,000 characters.

Default value:

N/A.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

group_id

Yes

String

Definition:

Host cluster ID.

Constraints:

N/A.

Value range:

32 characters, including letters and digits.

Default value:

N/A.

host_ids

Yes

Array of strings

Definition:

ID list of the hosts to be imported.

Constraints:

N/A.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

status

String

Definition:

Request status (successful or failed).

Value range:

  • success: Successful.

  • failed: Failed.

result

Array of strings

Definition:

ID list of the imported hosts.

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" : [ "8e1eb7f010d4442ca150e3a1a5d96d94" ]
}

Status Codes

Status Code

Description

200

OK: The request is successful.

Error Codes

See Error Codes.