主题
title: 根据msgId将消息设置为已读2.0 3.7.3.Beta1+
根据账号和消息id将消息设置为已读
接口说明
请求URL:http[s]://{网关地址}/mp/restful/v2/message/setMsgRead
请求方式: POST
请求内容类型: application/json
响应内容类型: application/json
请求说明
请求体
| 字段名 | 参数名 | 必填 | 类型 |
|---|---|---|---|
| 发送消息返回的msgId | msgIds | M | string |
| 用户账号 | userId | M | string |
| 签名(md5(accessToken+第一个msgId)) | sign | M | string |
请求示例
json
{
"msgIds":["1022239164272640","999588306617344"],
"userId":"ampadmin",
"sign":"78890c2c92a109a5cfeebfd22f7eec11"
}1
2
3
4
5
2
3
4
5
响应说明
响应体
| 字段名 | 参数名 | 类型 | 描述 |
|---|---|---|---|
| 状态码 | code | String | 0000请求成功 |
| 错误内容 | msg | string | 错误内容 |
响应示例
json
{
"code": "0000",
"subErrorCode": "0"
}1
2
3
4
2
3
4
错误码
| 错误码 | 描述 |
|---|---|
| 0000 | 请求成功 |
| 其他 | 失败 |
Demo
java
Client client = new DefaultClient(BASE_URL, APP_ID, APP_SECRET);
SetMsgReadV2Request request = new SetMsgReadV2Request();
List<String > msgIds=new ArrayList<String>();
msgIds.add("999587734066176");
msgIds.add("999581061886976");
request.setUserId("ampadmin");
request.setMsgIds(msgIds);
SetMsgReadV2Response 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
2
3
4
5
6
7
8
9
10
11
12
13

