Updated on 2025-12-29 GMT+08:00

Querying Exchanges

Function

This API is used to query exchanges.

Calling Method

For details, see Calling APIs.

URI

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

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

instance_id

Yes

String

Instance ID.

vhost

Yes

String

Virtual host name. If the name contains a slash (/), replace it with __F_SLASH__. Otherwise, the calling fails. For example, if the virtual host name is /test, the input parameter is __F_SLASH__test.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Offset, which is the position where the query starts. The value must be greater than or equal to 0.

limit

No

Integer

Number of records on each page. Range: 0–50. The default value is 10.

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

size

Integer

Number of displayed records.

total

Integer

Total number of results in a query.

items

Array of ExchangeDetails objects

Details of an exchange.

Table 4 ExchangeDetails

Parameter

Type

Description

durable

Boolean

Indicates whether data persistence is enabled.

default

Boolean

Indicates whether the exchange is default.

internal

Boolean

Indicates whether the exchange is internal.

arguments

Object

Parameter list.

name

String

Exchange name.

auto_delete

Boolean

Indicates whether automatic deletion is enabled.

type

String

Definition

x-delayed-type

Range

  • direct: Exchanges route messages to matching queues based on the routing keys.

  • fanout: Exchanges route messages to all bound queues.

  • topic: Exchanges route messages to queues based on routing key wildcard matching.

  • headers: Exchanges are related to the message headers. Routing keys are not used. Exchanges route messages based on matching between key-value pairs in the message headers and the binding (a key-value pair).

vhost

String

Virtual host.

Example Requests

Querying exchanges

GET /v2/rabbitmq/{project_id}/instances/{instance_id}/exchanges?offset=0&limit=10

Example Responses

Status code: 200

Successful

{
  "total" : 1,
  "size" : 1,
  "items" : [ {
    "durable" : true,
    "vhost" : "default",
    "default" : false,
    "internal" : false,
    "name" : "Exchange-name",
    "auto_delete" : false,
    "type" : "x-delayed-message",
    "arguments" : {
      "x-delayed-type" : "header"
    }
  } ]
}

Status Codes

Status Code

Description

200

Successful

Error Codes

See Error Codes.