All Products
Document Center


Last Updated: May 14, 2019


You can call this operation to conduct fuzzy search through the input topic and message key to obtain a list of desired messages.


Querying by calling this operation based on the message key is a fuzzy search. As the key of the service provider may not be unique, there may be multiple query results.

The operation is called when the service provider cannot obtain the message ID. The following describes the procedure for calling the operation.

  1. You can call this operation to conduct fuzzy search to obtain a list of message IDs.

  2. Call OnsMessageGetByMsgId to conduct an exact search. For more information about OnsMessageGetByMsgId, see OnsMessageGetByMsgId.

Request parameters

Name Type Required Description
PreventCache Long Yes The parameter used for CSRF verification, which can be set to the current system time. Unit: ms
InstanceId String No The ID of the instance.
Topic String Yes The topic of the message you want to query.
Key String Yes The message key of the message you want to query.

Response parameters

Name Type Description
RequestId String A common parameter. Each request has a unique ID.
HelpUrl String A help link.
Data List(OnsRestMessageDo) The query results.

Fields in OnsRestMessageDo

Name Type Description
Topic String The topic of the message.
PropertyList List(MessageProperty) A list of message properties.
Body String The message body.
StoreSize Integer The message size.
BornTimestamp Long The time when the message was generated.
BornHost String The producer that generated the message.
StoreTimestamp Long The time when the broker stores the message.
StoreHost String The broker that stored the message.
MsgId String The message ID.
BodyCRC Integer The message body CRC.
ReconsumeTimes Integer The number of message consumption retries.


For more information about sample codes, see API sample code and endpoints.