Updated on 2023-01-17 GMT+08:00

Querying the Topic List

Function

This API is used to query the topic list of a RocketMQ instance.

URI

GET /v2/{project_id}/instances/{instance_id}/topics

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

instance_id

Yes

String

Instance ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

Number of records to query.

offset

No

Integer

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

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

total

Integer

Total number of topics.

max

Integer

Maximum number of topics that can be created.

remaining

Integer

Remaining number of topics that can be created.

next_offset

Integer

Offset of the next page.

previous_offset

Integer

Offset of the previous page.

topics

Array of Topic objects

Topic list.

Table 4 Topic

Parameter

Type

Description

name

String

Topic name.

total_read_queue_num

Number

Total number of read queues.

total_write_queue_num

Number

Total number of write queues.

permission

String

Permissions.

brokers

Array of brokers objects

Associated brokers.

Table 5 brokers

Parameter

Type

Description

broker_name

String

Broker name.

read_queue_num

Number

Number of read queues.

write_queue_num

Number

Number of write queues.

Example Requests

Querying the topic list of a RocketMQ instance

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

Example Responses

Status code: 200

Query succeeded.

{
  "total" : "3,",
  "max" : "2000,",
  "remaining" : "1997,",
  "next_offset" : "-1,",
  "previous_offset" : "-1,",
  "topics" : [ {
    "name" : "topic-1",
    "total_read_queue_num" : 3,
    "total_write_queue_num" : 3,
    "permission" : "all",
    "brokers" : [ {
      "broker_name" : "broker-0",
      "read_queue_num" : 3,
      "write_queue_num" : 3
    } ]
  }, {
    "name" : "topic-2",
    "total_read_queue_num" : 3,
    "total_write_queue_num" : 3,
    "permission" : "all",
    "brokers" : [ {
      "broker_name" : "broker-0",
      "read_queue_num" : 3,
      "write_queue_num" : 3
    } ]
  }, {
    "name" : "topic-3",
    "total_read_queue_num" : 3,
    "total_write_queue_num" : 3,
    "permission" : "all",
    "brokers" : [ {
      "broker_name" : "broker-0",
      "read_queue_num" : 3,
      "write_queue_num" : 3
    } ]
  } ]
}

Status Codes

Status Code

Description

200

Query succeeded.

Error Codes

See Error Codes.