All Products
Search
Document Center

:ListMessages

Last Updated:Nov 28, 2024

Queries the list of messages.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
rocketmq:ListMessageslist
*Topic
acs:rocketmq:{#regionId}:{#accountId}:instance/{#InstanceId}/topic/{#TopicName}
    none
none

Request syntax

GET /instances/{instanceId}/topics/{topicName}/messages HTTP/1.1

Request parameters

ParameterTypeRequiredDescriptionExample
instanceIdstringYes

The instance ID.

rmq-cn-zvp2vtypu05
topicNamestringYes

The topic name.

test_delay_queue
messageIdstringNo

Message Id.

7F00000100207A4F0F294A938F7807AE
messageKeystringNo

Message key.

XSCBillResult
startTimestringNo

The beginning of the time range to query.

2024-09-09 08:00:00
endTimestringNo

The end of the time range to query.

2024-09-09 09:00:00
pageNumberintegerNo

The page number. Pages start from page 1.

1
pageSizeintegerNo

The number of entries per page.

10
scrollIdstringNo

The scroll ID of the request.

You do not need to configure this parameter for the first page. This parameter is included in the pagination request based on the result returned for the first page.

B13D0B07-F24B-4790-88D8-D47A38063D00

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

requestIdstring

The ID of the request. Each request has a unique ID. You can use this ID to troubleshoot issues.

A3531B6A-5A88-52BD-B3C4-A024C3D0AA2E
successboolean

Indicates whether the request was successful.

true
dataobject

The data returned.

pageNumberlong

The page number.

1
pageSizelong

The number of entries per page.

50
totalCountlong

The total number of returned entries.

0
listarray<object>

The pagination information.

listobject

The message information.

regionIdstring

The region ID.

cn-hangzhou
instanceIdstring

The instance ID.

rmq-cn-7e22ody****
topicNamestring

The name of the topic.

topic_test
messageIdstring

Message Id.

7F000001000114B4340C5ABF94500079
bornTimestring

Message born time.

2023-03-22 12:17:08
storeTimestring

Message store time.

2023-03-22 12:17:08
bodystring

Message body.

{}
bodySizeinteger

Message body size.

100
bornHoststring

The client on which messages are produced.

xx.xx.xx.xx
storeHoststring

The broker on which messages are stored.

xx.xx.xx.xx
messageTypestring

Message type.

NORMAL
messageTagstring

The message tag.

xx
messageGroupstring

The message group. This parameter is returned only for ordered messages.

xx
messageKeysarray

Message keys.

messageKeystring

Message key.

xx
userPropertiesobject

Message user properties.

string

Message user properties.

xx
scrollIdstring

The scroll ID of the request.

The ID is automatically generated by the system. The result can be paginated only if this parameter is included in the pagination request.

B13D0B07-F24B-4790-88D8-D47A38063D00
codestring

The error code.

MissingInstanceId
messagestring

The error message.

Parameter instanceId is mandatory for this action .
httpStatusCodeinteger

The HTTP status code.

200
dynamicCodestring

The dynamic error code.

InstanceId
dynamicMessagestring

The dynamic error message.

instanceId

Examples

Sample success responses

JSONformat

{
  "requestId": "A3531B6A-5A88-52BD-B3C4-A024C3D0AA2E",
  "success": true,
  "data": {
    "pageNumber": 1,
    "pageSize": 50,
    "totalCount": 0,
    "list": [
      {
        "regionId": "cn-hangzhou",
        "instanceId": "rmq-cn-7e22ody****",
        "topicName": "topic_test",
        "messageId": "7F000001000114B4340C5ABF94500079",
        "bornTime": "2023-03-22 12:17:08",
        "storeTime": "2023-03-22 12:17:08",
        "body": "{}",
        "bodySize": 100,
        "bornHost": "xx.xx.xx.xx",
        "storeHost": "xx.xx.xx.xx",
        "messageType": "NORMAL",
        "messageTag": "xx",
        "messageGroup": "xx",
        "messageKeys": [
          "xx"
        ],
        "userProperties": {
          "key": "xx"
        }
      }
    ],
    "scrollId": "B13D0B07-F24B-4790-88D8-D47A38063D00"
  },
  "code": "MissingInstanceId",
  "message": "Parameter instanceId is mandatory for this action .",
  "httpStatusCode": 200,
  "dynamicCode": "InstanceId",
  "dynamicMessage": "instanceId"
}

Error codes

For a list of error codes, visit the Service error codes.