Updated on 2022-09-15 GMT+08:00

Querying a Message with a Specified Offset

Function

This API is used to query a message with a specified offset.

URI

GET /v2/{project_id}/instances/{instance_id}/management/topics/{topic}/partitions/{partition}/message

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

instance_id

Yes

String

Instance ID.

topic

Yes

String

Topic name.

A topic name must start with a letter and can only contain letters, hyphens (-), underscores (_), and digits.

partition

Yes

Integer

Partition number.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

message_offset

Yes

String

Message offset.

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

message

Array of ShowPartitionMessageEntity objects

Message list.

Table 4 ShowPartitionMessageEntity

Parameter

Type

Description

key

String

Message key.

value

String

Message content.

topic

String

Topic name.

partition

Integer

Partition number.

message_offset

Long

Message offset.

size

Integer

Message size in bytes.

timestamp

Long

Time when a message is created. The value is a Unix timestamp. The unit is millisecond.

Example Requests

GET https://{endpoint}/v2/{project_id}/instances/{instance_id}/management/topics/{topic}/partitions/{partition}/message?message_offset={message_offset}

Example Responses

Status code: 200

The message with the specified offset is queried successfully.

{
  "message" : [ {
    "topic" : "mytest",
    "partition" : 0,
    "message_offset" : 7,
    "key" : null,
    "value" : "kasjdf",
    "size" : 6,
    "timestamp" : 1568125036045
  } ]
}

Status Codes

Status Code

Description

200

The message with the specified offset is queried successfully.

Error Codes

See Error Codes.