查询所有聊天记录
接口描述
1、查询账号下频道聊天记录
2、接口支持https协议
接口URL
http://api.polyv.net/live/v3/user/chat/get-speak-list
请求方式
GET
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
2、第一次查询不传cursor参数,后面的查询使用前一次返回的cursor,直到返回list没有数据
请求参数描述
timestamp
true
Long
当前13位毫秒级时间戳,3分钟内有效
sign
true
String
签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据
【详见签名生成规则】
startTime
false
Long
查询的开始时间 13位毫秒级时间戳
endTime
false
Long
查询的结束时间 13位毫秒级时间戳
cursor
false
String
第一次查询不传,后面的查询使用前一次返回的cursor即可,直到返回list没有数据
size
false
Integer
每页大小,默认为10,最大值为1000
示例
https://api.polyv.net/live/v3/user/chat/get-speak-list?cursor=6_2&size=3&appId=frlr1zazn3&sign=C63541E7ACE179314B087FB218925FBC&userId=1b448be323×tamp=1634284501527
响应参数描述
data字段说明
list字段说明
id
String
消息id
content
Boolean
消息内容
user
String
用户信息json数据【详见用户信息json字段说明】
image
String
发言图片
time
Long
发言时间戳
clientIP
String
客户ip
msgType
String
消息类型
roomId
String
房间号
sessionId
String
场次id
accountId
String
账号id
quote
String
回复id
用户信息json字段说明
actor
String
角色
banned
Boolean
是否禁言
channelId
String
频道号
clientIp
String
用户ip
nick
String
观众昵称
pic
String
观众头像
roomId
String
房间号
sessionId
String
场次号
uid
String
socketId
userId
String
用户唯一标示
userType
String
用户类型 slice:云课堂学员 teacher:讲师 guest:嘉宾 manager:管理员 assistant:助教 viewer:特邀观众 monitor:场监 attendee:研讨会参与者 student:普通直播观众
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
/**
* 测试查询频道连麦详情数据
* @throws IOException
*/
@Test
public void test() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "https://api.polyv.net/live/v3/user/chat/get-speak-list";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("userId",userId);
requestMap.put("cursor","6_2");
requestMap.put("size","3");
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询所有聊天记录,当前页查询成功,返回值:{}",response);
//do somethings
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"code": 200,
"status": "success",
"message": "",
"data": {
"size": 3,
"cursor": "7_3",
"list": [
{
"id": "f14e71f0-0fb5-11ec-912a-f7bfa2a37ef8",
"roomId": "2523307",
"content": "1",
"user": "{\"banned\":false,\"channelId\":\"2523307\",\"clientIp\":\"175.10.232.110\",\"customize\":0,\"nick\":\"a\",\"pic\":\"https://liveimages.videocc.net/defaultImg/avatar/viewer.png\",\"roomId\":\"2523307\",\"uid\":\"nhycNjFyZxSXuVz0AKNW\",\"userId\":\"1631003162428\",\"userType\":\"slice\"}",
"image": "",
"time": 1631003465350,
"clientIP": "",
"msgType": null,
"userType": "slice",
"sessionId": null,
"quote": null,
"accountId": "1b448be323"
},
{
"id": "f202a6c0-0fb5-11ec-912a-f7bfa2a37ef8",
"roomId": "2523307",
"content": "2",
"user": "{\"banned\":false,\"channelId\":\"2523307\",\"clientIp\":\"175.10.232.110\",\"customize\":0,\"nick\":\"a\",\"pic\":\"https://liveimages.videocc.net/defaultImg/avatar/viewer.png\",\"roomId\":\"2523307\",\"uid\":\"nhycNjFyZxSXuVz0AKNW\",\"userId\":\"1631003162428\",\"userType\":\"slice\"}",
"image": "",
"time": 1631003466531,
"clientIP": "",
"msgType": null,
"userType": "slice",
"sessionId": null,
"quote": null,
"accountId": "1b448be323"
},
{
"id": "f39331d0-0fb5-11ec-912a-f7bfa2a37ef8",
"roomId": "2523307",
"content": "35",
"user": "{\"banned\":false,\"channelId\":\"2523307\",\"clientIp\":\"175.10.232.110\",\"customize\":0,\"nick\":\"a\",\"pic\":\"https://liveimages.videocc.net/defaultImg/avatar/viewer.png\",\"roomId\":\"2523307\",\"uid\":\"nhycNjFyZxSXuVz0AKNW\",\"userId\":\"1631003162428\",\"userType\":\"slice\"}",
"image": "",
"time": 1631003469156,
"clientIP": "",
"msgType": null,
"userType": "slice",
"sessionId": null,
"quote": null,
"accountId": "1b448be323"
}
]
}
}
异常示例
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
Last updated
Was this helpful?