Updated on 2025-09-03 GMT+08:00

Querying Virtual Hosts

Function

This API is used to query virtual hosts.

URI

GET /v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. For details, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

instance_id

Yes

String

Definition:

Instance ID. You can call the API for querying all instances to obtain the instance ID. The instance ID is in the response body.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Parameter description:

Offset from which the query starts.

Constraints:

N/A

Value range:

≥ 0

Default value:

0

limit

No

Integer

Parameter description:

Number of records on a page.

Constraints:

N/A

Value range:

0–50

Default value:

10

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

size

Integer

Parameter description:

Number of current virtual hosts.

Value range:

N/A

total

Integer

Parameter description:

Total number of queried virtual hosts.

Value range:

N/A

items

Array of ShowVhostDetailResp objects

Parameter description:

Queried virtual host details.

Table 4 ShowVhostDetailResp

Parameter

Type

Description

name

String

Parameter description:

Virtual host name.

Value range:

N/A

tracing

Boolean

Definition

Indicates whether to enable message tracing.

Range

  • true: Yes

  • false: No

Example Requests

Querying virtual hosts

GET https://{endpoint}/v2/rabbitmq/{project_id}/instances/{instance_id}/vhosts?offset=0&limit=10

Example Responses

Status code: 200

Successful

{
  "size" : 10,
  "total" : 13,
  "items" : [ {
    "name" : "/",
    "tracing" : false
  }, {
    "name" : "test-vhost1",
    "tracing" : false
  }, {
    "name" : "test-vhost10",
    "tracing" : false
  }, {
    "name" : "test-vhost2",
    "tracing" : false
  }, {
    "name" : "test-vhost3",
    "tracing" : false
  }, {
    "name" : "test-vhost4",
    "tracing" : false
  }, {
    "name" : "test-vhost5",
    "tracing" : false
  }, {
    "name" : "test-vhost6",
    "tracing" : false
  }, {
    "name" : "test-vhost7",
    "tracing" : false
  }, {
    "name" : "test-vhost8",
    "tracing" : false
  } ]
}

Status Codes

Status Code

Description

200

Successful

Error Codes

See Error Codes.