https://xxxxxx/v4/openim/admin_getroammsg?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
参数 | 说明 |
xxxxxx | SDKAppID 所在国家/地区对应的专属域名: 中国: console.tim.qq.com 新加坡: adminapisgp.im.qcloud.com 首尔: adminapikr.im.qcloud.com 法兰克福: adminapiger.im.qcloud.com 硅谷: adminapiusa.im.qcloud.com 雅加达: adminapiidn.im.qcloud.com |
v4/openim/admin_getroammsg | 请求接口 |
sdkappid | 创建应用时即时通信 IM 控制台分配的 SDKAppID |
identifier | |
usersig | |
random | 请输入随机的32位无符号整数,取值范围0 - 4294967295 |
contenttype | 请求格式固定值为 json |
{"Operator_Account":"user2","Peer_Account":"user1","MaxCnt":100,"MinTime":1584669600,"MaxTime":1584673200}
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"Complete": 0,"MsgCnt": 12, //本次拉取返回了12条消息"LastMsgTime": 1584669680,"LastMsgKey": "549396494_2578554_1584669680","MsgList": [{"From_Account": "user1","To_Account": "user2","MsgSeq": 549396494,"MsgRandom": 2578554,"MsgTimeStamp": 1584669680,"MsgFlagBits": 0,"IsPeerRead": 0,"MsgKey": "549396494_2578554_1584669680","MsgBody": [{"MsgType": "TIMTextElem","MsgContent": {"Text": "msg 1"}}],"CloudCustomData": "your cloud custom data"},{"From_Account": "user2","To_Account": "user1","MsgSeq": 1054803289,"MsgRandom": 7201,"MsgTimeStamp": 1584669689,"MsgFlagBits": 0,"IsPeerRead": 0,"MsgKey": "1054803289_7201_1584669689","MsgBody": [{"MsgType": "TIMTextElem","MsgContent": {"Text": "msg 2"}}],"CloudCustomData": "your cloud custom data"},{ ... } //为节省篇幅,余下的10条消息未列出]}
"Complete": 0
表示该时间范围的消息未全部拉取,需要续拉。
续拉请求中的 MaxTime 应改成应答的 LastMsgTime 字段值,同时填上应答的 LastMsgKey 字段,如下所示:{"Operator_Account":"user2","Peer_Account":"user1","MaxCnt":100,"MinTime":1584669600,"MaxTime":1584669680,"LastMsgKey": "549396494_2578554_1584669680"}
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"Complete": 1,"MsgCnt": 5, //本次拉取返回了5条消息"LastMsgTime": 1584669601,"LastMsgKey": "1456_23287_1584669601","MsgList": [{"From_Account": "user1","To_Account": "user2","MsgSeq": 1456,"MsgRandom": 23287,"MsgTimeStamp": 1584669601,"MsgFlagBits": 0,"IsPeerRead": 1,"MsgKey": "1456_23287_1584669601","MsgBody": [{"MsgType": "TIMTextElem","MsgContent": {"Text": "msg 13"}}],"CloudCustomData": "your cloud custom data"},{"From_Account": "user2","To_Account": "user1","MsgSeq": 9806,"MsgRandom": 14,"MsgTimeStamp": 1584669602,"MsgFlagBits": 0,"IsPeerRead": 1,"MsgKey": "9806_14_1584669602","MsgBody": [{"MsgType": "TIMTextElem","MsgContent": {"Text": "msg 14"}}],"CloudCustomData": "your cloud custom data"},{ ... } //为节省篇幅,余下的3条消息未列出]}
"Complete": 1
表示该时间范围的消息已全部拉取。
若续拉的应答里 Complete 值为0,表明还需要继续续拉,直到 Complete 值为1。字段 | 类型 | 属性 | 说明 |
Operator_Account | String | 必填 | 会话其中一方的 UserID,以该 UserID 的角度去查询消息。同一个会话,分别以会话双方的角度去查询消息,结果可能会不一样,请参考本接口的接口说明 |
Peer_Account | String | 必填 | 会话的另一方 UserID |
MaxCnt | Integer | 必填 | 请求的消息条数 |
MinTime | Integer | 必填 | 请求的消息时间范围的最小值(单位:秒) |
MaxTime | Integer | 必填 | 请求的消息时间范围的最大值(单位:秒) |
LastMsgKey | String | 选填 | 上一次拉取到的最后一条消息的 MsgKey,续拉时需要填该字段,填写方法见上方 示例 |
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"Complete": 1,"MsgCnt": 1,"LastMsgTime": 1584669680,"LastMsgKey": "549396494_2578554_1584669680","MsgList": [{"From_Account": "user1","To_Account": "user2","MsgSeq": 549396494,"MsgRandom": 2578554,"MsgTimeStamp": 1584669680,"MsgFlagBits": 0,"IsPeerRead": 0,"MsgKey": "549396494_2578554_1584669680","MsgBody": [{"MsgType": "TIMTextElem","MsgContent": {"Text": "1"}}],"CloudCustomData": "your cloud custom data"}]}
{"ActionStatus": "FAIL","ErrorInfo": "Fail to Parse json data of body, Please check it","ErrorCode": 90001}
字段 | 类型 | 说明 |
ActionStatus | String | 请求处理的结果,OK 表示处理成功,FAIL 表示失败 |
ErrorCode | Integer | 错误码,0表示成功,非0表示失败 |
ErrorInfo | String | 错误信息 |
Complete | Integer | 是否全部拉取,0表示未全部拉取,需要续拉,1表示已全部拉取 |
MsgCnt | Integer | 本次拉取到的消息条数 |
LastMsgTime | Integer | 本次拉取到的消息里的最后一条消息的时间 |
LastMsgKey | String | 本次拉取到的消息里的最后一条消息的标识 |
MsgList | Array | 返回的消息列表 |
MsgFlagBits | Integer | 该条消息的属性,0表示正常消息,8表示被撤回的消息 |
IsPeerRead | Integer | 消息接收方是否发送该条消息的已读回执。0表示未发送,1表示已发送,详情可参考本接口的功能说明。 |
MsgBody | Array | |
CloudCustomData | String | 消息自定义数据(云端保存,会发送到对端,程序卸载重装后还能拉取到) |
MsgKey | String | 标识该条消息,可用于 REST API 撤回单聊消息 |
错误码 | 描述 |
90001 | JSON 格式解析失败,请检查请求包是否符合 JSON 规范 |
90003 | JSON 格式请求包体中缺少 To_Account 字段或者 To_Account 字段不是 String 类型 |
90008 | JSON 格式请求包体中缺少 From_Account 字段或者 From_Account 账号不存在。 |
90009 | 请求需要 App 管理员权限 |
91000 | 服务内部错误,请重试 |
本页内容是否解决了您的问题?