Add hosts to a host group

Updated at:

Applicable editions

Centralized edition, region edition

Endpoint and authorization

  • Get an endpoint: Replace {domain} in the API request syntax.
  • Get a personal access token.
  • Get the organization ID: Required only for the centralized edition. Go to the Organization Management console and get the organization ID on the Basic Information page.

Product

Resource

Required permission

AppStack

resource

Read/Write

Request syntax

Centralized edition

PUT https://{domain}/oapi/v1/appstack/organizations/{organizationId}/pools/instances/{instanceName}/addHostList

Region edition

PUT https://{domain}/oapi/v1/appstack/pools/instances/{instanceName}/addHostList

Request headers

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

A personal access token.

pt-0fh3****0fbG_35af****0484

Request parameters

Parameter

Type

In

Required

Description

Example value

instanceName

string

path

Yes

The name of the host group (not the display name).

my-host-group

organizationId

string

path

  • Required for the centralized edition.

  • Not applicable for the region edition.

The organization ID.

ec766e63aee3437d9a51f334d6exe671

-

object

body

No

hostSns

array[string]

body

Yes

A list of ECS host instance IDs. Only ECS instances are supported as hosts.

["i-ssssssa", "i-ssssssb", "i-ssssssc"]

Request examples

Centralized edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/appstack/organizations/ec766e63aee3437d9a51f334d6exe671/pools/instances/my-host-group/addHostList' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "hostSns": ["i-ssssssa", "i-ssssssb", "i-ssssssc"]
    }'

Region edition

curl -X 'PUT' \
  'https://{domain}/oapi/v1/appstack/pools/instances/my-host-group/addHostList' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "hostSns": ["i-ssssssa", "i-ssssssb", "i-ssssssc"]
    }'

Response parameters

Parameter

Type

Description

Example value

-

boolean

Returns true on success.

true

Response example

true

Error codes

See the Error Code Center for API error codes.