Query Overview Statistics for Multiple Channels
Updated: 2025-07-30 10:13:32
API Description
1、根据提交的频道号,查询频道有关信息的统计数据,数据会根据频道号进行汇总,返回pc端播放时长、pc端播放流量、移动端播放时长、移动端播放流量等。
2、接口URL中的{userId}为直播账号ID
3、接口支持https协议
API URL
http://api.polyv.net/live/v2/statistics/{userId}/channel_summary
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details on obtaining keys |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See signature generation rules |
| startDate | true | String | Start date, format: yyyy-MM-dd |
| endDate | true | String | End date, format: yyyy-MM-dd |
| channelIds | false | String | Channel IDs to query. Multiple channel IDs should be separated by commas, e.g., 105420,104400. If not submitted, defaults to querying all channels. |
Example
http://api.polyv.net/live/v2/statistics/1b448be323/channel_summary
Form Parameters:
endDate=2021-3-10&appId=frlr1zazn3&sign=F41732400823BE2D36DF9BF3294AC3F2&channelIds=1965681%2C2149813&startDate=2021-3-9×tamp=1621842318097
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure. See global error description |
| status | String | Response status text |
| message | String | Response description. When code is 400 or 500, provides additional error details. |
| data | Array | Channel information on success See Data parameter description, empty on failure. |
Data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| userId | String | Account ID |
| channelId | String | Channel ID |
| name | String | Channel name |
| pcPlayDuration | Integer | PC playback duration, unit: minutes |
| pcVideoView | Integer | PC play count |
| pcUniqueViewer | Integer | PC unique viewers |
| mobilePlayDuration | Integer | Mobile playback duration, unit: minutes |
| mobileVideoView | Integer | Mobile play count |
| mobileUniqueViewer | Integer | Mobile unique viewers |
| livePcPlayDuration | Integer | PC live playback duration, unit: minutes |
| playbackPcPlayDuration | Integer | PC replay playback duration, unit: minutes |
| liveMobilePlayDuration | Integer | Mobile live playback duration, unit: minutes |
| playbackMobilePlayDuration | Integer | Mobile replay playback duration, unit: minutes |
| unknownPcPlayDuration | Integer | PC other playback duration, unit: minutes |
| unknownMobilePlayDuration | Integer | Mobile other playback duration, unit: minutes |
Java Request Example
For quick integration, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.
It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(ChannelViewDataTest.class);
/**
* 查询多个频道概览统计数据
* @throws IOException
*/
@Test
public void testChannelSummary() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/live/v2/statistics/%s/channel_summary",userId);
String startDate = "2021-3-9";
String endDate = "2021-3-10";
String channelIds = "1965681,2149813";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("startDate",startDate);
requestMap.put("endDate",endDate);
requestMap.put("channelIds",channelIds);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFormBody(url, requestMap);
log.info("测试查询多个频道概览统计数据,返回值:{}",response);
//do somethings
}
Response Example
For global error descriptions, see Global Error Description
Success Example
{
"code":200,
"status":"success",
"message":"",
"data":[
{
"userId":null,
"channelId":2149813,
"name":"创建并初始化频道-验证码观看直播一次",
"categoryName":null,
"pcPlayDuration":0,
"pcVideoView":0,
"pcUniqueViewer":0,
"mobilePlayDuration":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"livePcPlayDuration":0,
"playbackPcPlayDuration":0,
"unknownPcPlayDuration":0,
"liveMobilePlayDuration":0,
"playbackMobilePlayDuration":0,
"unknownMobilePlayDuration":0,
"creatorName":null
},
{
"userId":null,
"channelId":1965681,
"name":"Junit测试(勿删)",
"categoryName":null,
"pcPlayDuration":0,
"pcVideoView":0,
"pcUniqueViewer":0,
"mobilePlayDuration":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"livePcPlayDuration":0,
"playbackPcPlayDuration":0,
"unknownPcPlayDuration":0,
"liveMobilePlayDuration":0,
"playbackMobilePlayDuration":0,
"unknownMobilePlayDuration":0,
"creatorName":null
}
]
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
