获取多个频道下(聚合查询结果)的终端分布信息
接口URL
https://api.polyv.net/live/v3/channel/statistics/browsers-summary
接口说明
1、接口用于获取多个频道下(聚合查询结果)的终端分布信息
2、接口支持https
支持格式
JSON
请求方式
GET
请求数限制
TRUE
请求参数
参数名
必选
类型
说明
appId
是
string
从API设置中获取,在直播系统登记的appId
timestamp
是
long
当前13位毫秒级时间戳,3分钟内有效
sign
是
String
签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据
【详见签名生成规则】
channelId
是
string
频道号,多个频道以,隔开
startDate
是
string
开始日期格式,yyyy-MM-dd
endDate
是
string
结束日期格式,yyyy-MM-dd
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": [{
"browser": "Chrome 浏览器",
"count": 69,
"platform": "pc",
"percent": 98.57
},
{
"browser": "IE 11.0 浏览器",
"count": 1,
"platform": "pc",
"percent": 1.43
}]
}
响应失败JSON示例:
未输入appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
appId不正确
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
时间戳错误
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
签名错误
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
频道号非法
{
"code": 403,
"status": "error",
"message": "illegal channel id: 1234567",
"data": ""
}
频道号格式错误
{
"code": 400,
"status": "error",
"message": "param is not digit: dsadasd",
"data": ""
}
日期范围错误
{
"code": 400,
"status": "error",
"message": "startDate can not great endDater",
"data": ""
}
字段说明
参数名
说明
code
响应代码,成功为200,失败为400,签名错误为401,异常错误500
status
成功为success,失败为error
message
错误时为错误提示消息
data
日期区间内的多个频道下(聚合查询结果)的终端分布信息
Java请求示例
public static void main(String[] args) {
String url = "http://api.polyv.net/live/v3/channel/statistics/browsers-summary;
// 用户对应的appId和加密串
String appId = "xxxxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
Map<String, String> params = new HashMap<>();
int channelId = 1234567;
String startDate = "2020-08-01";
String endDate = "2020-08-18";
params.put("channelId", String.valueOf(channelId));
params.put("startDate", startDate);
params.put("endDate", endDate);
PolyvTool.setLiveSign(params, appId, appSecret);
// 调用Polyv的httpClient工具类发送请求
String content = HttpClientUtil.getInstance()
.sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
System.out.println(content);
}
Last updated
Was this helpful?