
# 查询分区指定时间段的消息
![](https://support.huaweicloud.com/api-kafka/public_sys-resources/note_3.0-zh-cn.png)
当前页面API为历史版本API，未来可能停止维护。
#### URI
GET /v1.0/{project_id}/instances/{instance_id}/manage/topics/{topic}/messages?partition={partition}\&start_time={start_time}\&end_time={end_time}\&limit={limit}\&offset={offset}
参数说明请参考[表1]
 表1参数说明 
| 参数          | 类型      | 必选 | 说明                            |
|:---|:---|:---|:---|
| project_id  | String  | 是  | 项目ID。                         |
| instance_id | String  | 是  | 实例ID。                         |
| topic       | String  | 是  | Topic名称。                      |
| partition   | Integer | 否  | 分区编号，默认值为-1，若传入值为-1，则查询所有分区。  |
| start_time  | Long    | 否  | 查询起始时间，为unix时间戳格式，默认值为0。      |
| end_time    | Long    | 否  | 查询结束时间，为unix时间戳格式，默认值为系统当前时间。 |
| limit       | Integer | 否  | 单页返回消息数，默认值为10。               |
| offset      | Integer | 否  | 查询的页码，默认值为1。                  |
   
#### 请求消息
**请求参数**
无
**请求示例**
无。
#### 响应消息
**响应参数**
参数说明见[表2]。
 表2响应参数说明 
| 参数             | 类型              | 说明                                                   |
|:---|:---|:---|
| messages       | Array\<Object\> | 消息列表，见[表3]。 |
| messages_count | Long            | 消息总数。                                                |
| offsets_count  | Integer         | 总页数。                                                 |
| offset         | Integer         | 当前页数。                                                |
   
 表3messages参数说明 
| 参数             | 类型      | 说明         |
|:---|:---|:---|
| topic          | String  | topic名称。   |
| partition      | Integer | 分区编号。      |
| message_offset | Long    | 消息编号。      |
| size           | Integer | 消息大小，单位字节。 |
| timestamp      | Long    | 消息时间戳。     |
   
**响应示例**
```
{
    "messages": [
        {
            "topic": "mytest",
            "partition": 0,
            "message_offset": 7,
            "size": 6,
            "timestamp": 1568125036045
        }
    ],
    "messages_count": 1,
    "offsets_count": 1,
    "offset": 1
}
```
