主题
通过账号查询消息列表 3.5.5.SP2+
通过账号查询消息列表
接口说明
请求URL:http[s]://{网关地址}/mp/restful/v2/getMessageListByUserAccount
请求方式: POST
请求内容类型: application/json
响应内容类型: application/json
请求说明
请求体
| 字段名 | 参数名 | 必填 | 类型 |
|---|---|---|---|
| 用户账号 | userAccount | M | string |
| 消息详情是否展示(0:不展示 1:展示 默认不展示) | messageDetailShow | O | int |
| 是否已读(0:未读 1:已读)不传该字段为全部消息 | isRead | O | integer |
| 设备类型(0:移动 1:pc 默认pc ) | deviceType | O | int |
| 发送方式 | sendType | O | int |
| 是否必读(1:必读 默认返回全部类型) | isMustRead | O | int |
| 是否标棋(0:否 1:是 -1:全部) | collected | O | int |
| appId 不传为全部 | appId | O | int |
| 搜索内容 | searchContent | O | string |
| 分页大小 默认10 | pageSize | O | int |
| 页码 默认1 | pageNumber | O | int |
| 开始时间( yyyy-MM-dd HH:mm:sss) | startTime | O | string |
| 结束时间() yyyy-MM-dd HH:mm:sss) | endTime | O | string |
| 排序方式(0:优先展示未读消息再以时间排序 1:以时间排序 默认0) | orderType | O | int |
请求示例
json
{
"userAccount":"ampadmin"
}1
2
3
2
3
响应说明
响应体`
| 字段名 | 参数名 | 类型 | 描述 |
|---|---|---|---|
| 状态码 | code | String | 0000请求成功 |
| 错误内容 | msg | string | 错误内容 |
| 数据集 | data | PageEntity<MsgVo> | 分页数据 |
| 字段名 | 参数名 | 类型 |
|---|---|---|
| 结果集 | result | List<MsgVo> |
| 总数 | totalSize | int |
| 字段名 | 参数名 | 类型 |
|---|---|---|
| appId | appId | string |
| appName | appName | string |
| 是否标棋 0:标旗 1:标旗 | collected | int |
| 收件箱id | id | string |
| 收件箱url | inboxUrl | string |
| 是否已读 0:未读 1:已读 | isReaded | int |
| 是否删除 0 未删除 1:已删除 | isDeleted | int |
| 消息内容 | msgContent | string |
| 应用消息id | msgId | string |
| 消息发送时间 | msgSendDate | string |
| 消息标题 | msgTitle | string |
| 消息类型 0 普通 1:必读消息 | msgType | int |
| 发送方式 1:收件箱 2:今日校园 3:邮箱 4短信 5企业微信 6 钉钉 7 微信服务号 8 welink | sendType | List<String> |
| 展示类型 0 :移动 1:pc 这个会影响 收件箱地址是移动端的还是pc端的 | deviceType | int |
响应示例
json
{
"code": "0000",
"data": {
"result": [
{
"appId": "casp.cal",
"appName": "Schedule aggregation",
"collected": 0,
"id": "857348250122240",
"inboxUrl": "http://172.16.72.222:8080/message_pocket_web/inboxh5/h5.html#/messageDetail?id=857348250122240&msgId=857348250081280&from=SystemDetail",
"isDeleted": 0,
"isReaded": 0,
"msgContent": "2023/07/17 00:00:00 - 2023/07/21 23:59:59 11111 2023/07/17 08:00:00 - 2023/07/17 09:00:00",
"msgId": "857348250081280",
"msgSendDate": "2023-07-16 12:00:03",
"msgTitle": "2023/07/17 - 2023/07/23",
"msgType": 0,
"sendType": [
"1",
"2"
]
}
],
"totalSize": 3417
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
错误码
| 错误码 | 描述 |
|---|---|
| 0000 | 请求成功 |
| 301114 | 应用消息id已经撤回了,不允许重复调用 |
| 其他 | 失败 |
Demo
java
Client client = new DefaultClient(BASE_URL, APP_ID, APP_SECRET);
GetMessageListByUserAccountRequest request = new GetMessageListByUserAccountRequest();
request.setUserAccount("01119092");
request.setMessageDetailShow(MessageDetailShow_Constants.SHOW);
request.setIsRead(IsRead_Constants.ALL);
request.setDeviceType(DeviceType_Constants.PC);
request.setSendType(Integer.parseInt(SendType_Constants.PORTAL_ONLY));
request.setCollected(Collect_Constants.NOT_COLLECTED);
request.setIsMustRead(MustRead_Constants.ALL);
request.setAppId("1129811451821973504");
request.setPageNumber(1);
request.setPageSize(10);
GetMessageListByUserAccountResponse response = client.execute(request);
if (response.isSuccess()) {
System.out.println(JSONObject.toJSONString(response));
} else {
throw new Exception("获取启用通道异常:" + JSONObject.toJSONString(response));
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

