Querying Topic Details
Function
This API is used to query topic details of a Kafka instance. (Up to 1s for each instance call)
URI
GET /v2/{project_id}/instances/{instance_id}/management/topics/{topic}
| 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 |
| topic | Yes | String | Definition: Topic name. Constraints: N/A Range: N/A Default Value: N/A |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| topic | String | Definition: Topic name. Range: N/A |
| partitions | Array of partitions objects | Definition: Partition list. |
| group_subscribed | Array of strings | Definition: List of consumer groups that subscribe to the topic. |
| Parameter | Type | Description |
|---|---|---|
| partition | Integer | Definition: Partition ID. Range: N/A |
| leader | Integer | Definition: ID of the broker where the leader replica resides. Range: N/A |
| leo | Integer | Definition: LEO of the partition leader replica. Range: N/A |
| hw | Integer | Definition: High watermark (HW) of the partition. Range: N/A |
| lso | Integer | Definition: Log start offset (LSO) of the partition leader replica. Range: N/A |
| last_update_timestamp | Long | Definition: Time when the last message was written to the partition. The value is a Unix timestamp. Unit: millisecond Range: N/A |
| replicas | Array of replicas objects | Definition: Replica list. |
| Parameter | Type | Description |
|---|---|---|
| broker | Integer | Definition: ID of the broker where the replica resides. Range: N/A |
| leader | Boolean | Definition: Whether the replica is the leader. Range:
|
| in_sync | Boolean | Definition: Whether the replica is in the ISR. Range:
|
| size | Integer | Definition: Current log size of the replica. Unit: byte Range: N/A |
| lag | Long | Definition: Number of messages that lag behind the high watermark in the replica. Range: N/A |
Example Requests
Querying details about a specified topic
GET https://{endpoint}/v2/{project_id}/instances/{instance_id}/management/topics/{topic} Example Responses
Status code: 200
The query is successful.
{
"topic" : "test",
"partitions" : [ {
"partition" : 0,
"leader" : 2,
"replicas" : [ {
"broker" : 2,
"leader" : true,
"in_sync" : true,
"size" : 123971146,
"lag" : 0
}, {
"broker" : 1,
"leader" : false,
"in_sync" : true,
"size" : 123971146,
"lag" : 0
}, {
"broker" : 0,
"leader" : false,
"in_sync" : true,
"size" : 123971146,
"lag" : 0
} ],
"lso" : 0,
"leo" : 13598,
"hw" : 13598,
"last_update_timestamp" : 1571477180985
}, {
"partition" : 2,
"leader" : 1,
"replicas" : [ {
"broker" : 1,
"leader" : true,
"in_sync" : true,
"size" : 123889531,
"lag" : 0
}, {
"broker" : 0,
"leader" : false,
"in_sync" : true,
"size" : 123889531,
"lag" : 0
}, {
"broker" : 2,
"leader" : false,
"in_sync" : true,
"size" : 123889531,
"lag" : 0
} ],
"lso" : 0,
"leo" : 13601,
"hw" : 13601,
"last_update_timestamp" : 1571477077146
}, {
"partition" : 1,
"leader" : 0,
"replicas" : [ {
"broker" : 0,
"leader" : true,
"in_sync" : true,
"size" : 127245604,
"lag" : 0
}, {
"broker" : 2,
"leader" : false,
"in_sync" : true,
"size" : 127245604,
"lag" : 0
}, {
"broker" : 1,
"leader" : false,
"in_sync" : true,
"size" : 127245604,
"lag" : 0
} ],
"lso" : 0,
"leo" : 13599,
"hw" : 13599,
"last_update_timestamp" : 1571477172959
} ],
"group_subscribed" : [ "test-consumer-group" ]
} Status Codes
| Status Code | Description |
|---|---|
| 200 | The query is successful. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot