获取多个频道下(聚合查询结果)的终端分布信息

接口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值
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);
    }

签名规则(PolyvTool.java文件代码查看)

https://dev.polyv.net/2020/liveproduct/l-api/rule/live-api-java-detail/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...