https://api.polyv.net/live/v3/channel/statistics/concurrence-mc
1、接口用于获取多个频道下的历史并发记录(聚合数据,按照时间升序排序)
2、日期参数跨天则天为粒度,一天之内则以分钟为粒度返回
3、接口支持https
{
"code": 200,
"status": "success",
"message": "",
"data": [
{
"day": "2020-08-16",
"minute": "00:00",
"viewers": 0
},
{
"day": "2020-08-17",
"minute": "00:00",
"viewers": 2
},
{
"day": "2020-08-18",
"minute": "00:00",
"viewers": 0
}
]
}
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
{
"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": ""
}
public static void main(String[] args) {
String url = "http://api.polyv.net/live/v3/channel/statistics/concurrence-mc;
// 用户对应的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);
}