Channel Summary Statistics
Updated: 2022-05-23 19:02:59
Interface URL
https://api.polyv.net/live/v3/user/statistics/channels-summary
Interface Description
1. This interface is used to query aggregated viewing statistics for multiple live channels.
2. The interface supports HTTPS.
Supported Format
JSON
Request Method
GET
Request Limit
TRUE
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | Yes | string | Obtained from API settings, the appId registered in the live streaming system. |
| timestamp | Yes | long | 13-digit current millisecond timestamp. |
| sign | Yes | string | Signature value. |
| startDate | Yes | string | Start date, format yyyy-MM-dd. |
| endDate | Yes | string | End date, format yyyy-MM-dd. |
| channelIds | Yes | string | Channel IDs, multiple channels separated by ','. |
Successful Response JSON Example:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"list": [
{
"channelId": 1938990,
"pcPlayDuration": 3,
"pcFlowSize": 0,
"pcVideoView": 2,
"pcUniqueViewer": 1,
"mobilePlayDuration": 0,
"mobileFlowSize": 0,
"mobileVideoView": 0,
"concurrenceCount": 2,
"mobileUniqueViewer": 0
},
{
"channelId": 1947328,
"pcPlayDuration": 320,
"pcFlowSize": 0,
"pcVideoView": 183,
"pcUniqueViewer": 58,
"mobilePlayDuration": 16,
"mobileFlowSize": 0,
"mobileVideoView": 12,
"concurrenceCount": 5,
"mobileUniqueViewer": 5
}
]
}
}
Response Field Description
| Parameter | Description |
|---|---|
| code | Status code: 200 for success, 403 for signature failure, 400 for parameter error, 500 for server error. |
| status | "success" on success, "error" on failure. |
| message | Empty string "" on success, error description on failure. |
| data | Response data. |
| data.list.channelId | Channel ID. |
| data.list.pcPlayDuration | PC playback duration, unit: minutes. |
| data.list.pcFlowSize | PC data consumption, unit: bytes. |
| data.list.pcVideoView | Total PC play count, similar to PV. |
| data.list.pcUniqueViewer | Unique PC viewers, similar to UV. |
| data.list.mobilePlayDuration | Mobile playback duration, unit: minutes. |
| data.list.mobileFlowSize | Mobile data consumption, unit: bytes. |
| data.list.mobileVideoView | Total mobile play count, similar to PV. |
| data.list.mobileUniqueViewer | Unique mobile viewers, similar to UV. |
| data.list.concurrenceCount | Peak concurrent viewers. |
Failed Response JSON Examples:
Parameter error
{
"code": 400,
"status": "error",
"message": "param validate error",
"data": ""
}
Missing appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
Incorrect appId
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
Invalid timestamp
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
Signature error
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
Illegal channel ID
{
"code": 403,
"status": "error",
"message": "illegal channel id: %s",
"data": ""
}
Java Request Example
public void testAddRecordTask() {
String url = "https://api.polyv.net/live/v3/user/statistics/channels-summary";
// appId and encryption key
String appId = "xxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxx";
Map params = new HashMap<>();
params.put("channelIds", "2232850");
params.put("startDate", "2020-12-01");
params.put("endDate", "2021-01-11");
// Use Polyv utility method to set sign
PolyvTool.setLiveSign(params, appId, appSecret);
String content = HttpClientUtil.getInstance()
.sendHttpPost(url, params);
System.out.println(content);
}
