Querying Topics of a Specified Consumer Group

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

Function

This API is used to query topics of a specified consumer group.

Calling Method

For details, see Calling APIs.

URI

GET /v2/{engine}/{project_id}/instances/{instance_id}/groups/{group}/topics

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

engine

Yes

String

Engine.

project_id

Yes

String

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

instance_id

Yes

String

Instance ID.

group

Yes

String

Consumer group ID.

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

Maximum number of topics returned in the current query. The default value is 10. The value ranges from 1 to 50.

sort_key

No

String

Sort by:

  • topic: topic name

  • partition: number of partitions

  • messages (default): number of messages

sort_dir

No

String

Sort in:

  • asc: ascending order

  • desc (default): descending order

topic

No

String

Topic name.

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

topics

Array of GroupTopicEntity objects

Consumer group topic.

total

Integer

Total.

Table 4 GroupTopicEntity

Parameter

Type

Description

topic

String

Topic name.

partitions

Integer

Partition.

lag

Integer

Number of stacked messages.

Example Requests

GET https://{endpoint}/v2/{engine}/{project_id}/instances/{instance_id}/groups/{group}/topics

Example Responses

Status code: 200

Successful

{
  "topics" : [ {
    "topic" : "topic-1",
    "partitions" : 1,
    "lag" : 0
  }, {
    "topic" : "topic-2",
    "partitions" : 2,
    "lag" : 10
  } ],
  "total" : 2
}

Status Codes

Status Code

Description

200

Successful

Error Codes

See Error Codes.

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback