Querying a Message with the Specified Time Period

This API is out-of-date and may not be maintained in the future.

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}

Table 1 describes the parameters.

Table 1 Parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Project ID.

instance_id

String

Yes

Instance ID.

topic

String

Yes

Topic name.

partition

Integer

No

Partition number. The default value is -1, indicating that all partitions are queried.

start_time

Long

No

Query start time, as a Unix timestamp. Default value: 0.

end_time

Long

No

Query end time, as a Unix timestamp. Default value: current system time.

limit

Integer

No

Number of messages returned on a page. Default value: 10.

offset

Integer

No

Number of the page to be queried. Default value: 1.

Request

Request parameters

None.

Example request

None.

Response

Response parameters

Table 2 describes the response parameter.

Table 2 Response parameters

Parameter

Type

Description

messages

Array<Object>

Message list. For details, see Table 3.

messages_count

Long

Total number of messages.

offsets_count

Integer

Total number of pages.

offset

Integer

Current page number.

Table 3 messages parameters

Parameter

Type

Description

topic

String

Topic name.

partition

Integer

Partition number.

message_offset

Long

Message ID.

size

Integer

Message size, in bytes.

timestamp

Long

Message timestamp.

Example response

{
    "messages": [
        {
            "topic": "mytest",
            "partition": 0,
            "message_offset": 7,
            "size": 6,
            "timestamp": 1568125036045
        }
    ],
    "messages_count": 1,
    "offsets_count": 1,
    "offset": 1
}