更新时间:2025-09-03 GMT+08:00

查询Topic的分区列表

功能介绍

查询Topic的分区列表

URI

GET /v2/{project_id}/kafka/instances/{instance_id}/topics/{topic}/partitions

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID,获取方式请参见获取项目ID

instance_id

String

实例id

topic

String

主题

表2 Query参数

参数

是否必选

参数类型

描述

offset

Integer

偏移量,表示查询该偏移量后面的记录

limit

Integer

查询返回记录的数量限制

请求参数

响应参数

状态码:200

表3 响应Body参数

参数

参数类型

描述

total

Integer

总条数

partitions

Array of partitions objects

分区数组

表4 partitions

参数

参数类型

描述

partition

Integer

分区ID

start_offset

Long

起始偏移量

last_offset

Long

最后偏移量

message_count

Long

分区消息数

last_update_time

Long

最近更新时间

请求示例

查询topic的分区列表

GET https://{endpoint}/v2/{project_id}/kafka/instances/{instance_id}/topics/{topic}/partitions?start=1&limit=10

响应示例

状态码:200

查询topic的分区列表成功

{
  "total" : 3,
  "partitions" : [ {
    "partition" : 0,
    "start_offset" : 0,
    "last_offset" : 1216303,
    "message_count" : 1216303,
    "last_update_time" : 1688011291458
  }, {
    "partition" : 1,
    "start_offset" : 0,
    "last_offset" : 985447,
    "message_count" : 985447,
    "last_update_time" : 1688011291469
  }, {
    "partition" : 2,
    "start_offset" : 0,
    "last_offset" : 923340,
    "message_count" : 923340,
    "last_update_time" : 1688011291526
  } ]
}

状态码

状态码

描述

200

查询topic的分区列表成功

错误码

请参见错误码