ListHostGroups - Query a list of host groups

Updated at:

Queries a list of host groups.

Applicable editions

Central edition, Region edition

Endpoint and authorization information

  • Obtain the endpoint: Replace {domain} in the API request syntax.
  • Obtain a personal access token.
  • Obtain the organizationId: Required only for the Central edition. Go to the Basic Information page in the Organization Management console to view your organization ID.

Product

Resource

Required permission

Pipeline

Host group

Read-only

Request syntax

Central edition

GET https://{domain}/oapi/v1/flow/organizations/{organizationId}/hostGroups

Region edition

GET https://{domain}/oapi/v1/flow/hostGroups

Request headers

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

The personal access token.

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

Request parameters

Parameter

Type

Location

Required

Description

Example value

organizationId

string

path

  • Yes: Central edition

  • No: Region edition

The organization ID.

5ebbc0228123212b59xxxxx

ids

string

query

No

The host group IDs. Separate multiple IDs with commas.

121,1212121232

name

string

query

No

The host group name.

Host group

createStartTime

integer

query

No

The host group creation start time.

1586863220000

createEndTime

integer

query

No

The host group creation end time.

1586863220000

creatorAccountIds

string

query

No

The Alibaba Cloud account IDs of the creators. Separate multiple IDs with commas.

1112122121,3223332

perPage

integer

query

No

The number of entries per page. Default value: 10. Maximum value: 30.

10

page

integer

query

No

The page number. Default value: 1.

1

pageSort

string

query

No

The field to sort by.

ID

pageOrder

string

query

No

The sort order. Valid values: DESC (descending) and ASC (ascending).

DESC

Request examples

Central edition

curl -X 'GET' \
  'https://{domain}/oapi/v1/flow/organizations/5ebbc0228123212b59xxxxx/hostGroups?ids=121,1212121232&name=Host%20group&createStartTime=1586863220000&createEndTime=1586863220000&creatorAccountIds=1112122121,3223332&perPage=10&page=1&pageSort=ID&pageOrder=DESC' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Region edition

curl -X 'GET' \
  'https://{domain}/oapi/v1/flow/hostGroups?ids=121,1212121232&name=Host%20group&createStartTime=1586863220000&createEndTime=1586863220000&creatorAccountIds=1112122121,3223332&perPage=10&page=1&pageSort=ID&pageOrder=DESC' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Response parameters

Parameter

Type

Description

Example value

-

array

-

object

aliyunRegion

string

The Alibaba Cloud region.

cn-hangzhou

createTime

integer

The creation time.

1586863220000

creatorAccountId

string

The Alibaba Cloud account ID of the creator.

1111111111111

description

string

The host group description.

Host group description

ecsLabelKey

string

The ECS tag key.

ecs

ecsLabelValue

string

The ECS tag value.

ecs

ecsType

string

The ECS type. Only ECS_ALIYUN is supported.

ECS_ALIYUN

hostInfos

array

-

object

aliyunRegion

string

The Alibaba Cloud region.

cn-hangzhou

createTime

integer

The creation time.

1586863220000

creatorAccountId

string

The Alibaba Cloud account ID of the creator.

1111111111111

instanceName

string

The hostname.

ceshi

ip

string

The IP address of the machine.

127.0.0.1

machineSn

string

The serial number of the machine.

1ssasa

modifierAccountId

string

The Alibaba Cloud account ID of the modifier.

1111111111111

objectType

string

Fixed value: MachineInfo.

MachineInfo

status

string

The Runner status.

ok

updateTime

integer

The update time.

1586863220000

hostNum

integer

The number of hosts.

1

id

integer

The host group ID.

1234

modifierAccountId

string

The Alibaba Cloud account ID of the modifier.

1111111111111

name

string

The host group name.

Host group name

serviceConnectionId

integer

The service connection ID.

1234

type

string

The host group type.

ECS

updateTime

integer

The update time.

1586863220000

uuid

string

The host group UUID.

KxqtcgPp7y5ROZdd

Response example

[
    {
        "aliyunRegion": "cn-hangzhou",
        "createTime": 1586863220000,
        "creatorAccountId": "1111111111111",
        "description": "Host group description",
        "ecsLabelKey": "ecs",
        "ecsLabelValue": "ecs",
        "ecsType": "ECS_ALIYUN",
        "hostInfos": [
            {
                "aliyunRegion": "cn-hangzhou",
                "createTime": 1586863220000,
                "creatorAccountId": "1111111111111",
                "instanceName": "ceshi",
                "ip": "127.0.0.1",
                "machineSn": "1ssasa",
                "modifierAccountId": "1111111111111",
                "objectType": "MachineInfo",
                "status": "ok",
                "updateTime": 1586863220000
            }
        ],
        "hostNum": 1,
        "id": 1234,
        "modifierAccountId": "1111111111111",
        "name": "Host group name",
        "serviceConnectionId": 1234,
        "type": "ECS",
        "updateTime": 1586863220000,
        "uuid": "KxqtcgPp7y5ROZdd"
    }
]

Response headers

Parameter

Description

Example value

x-next-page

The next page number.

3

x-page

The current page number.

2

x-per-page

The number of entries per page.

10

x-prev-page

The previous page number.

1

x-total

The total number of entries.

100

x-total-pages

The total number of pages.

10

Error codes

For API error codes, see Error Code Center.