Query Live Channel Viewing Details Within a Time Range
API Description
1、通过频道号获取该频道某段时间的直播观看的统计数据
2、接口支持https协议
API URL
http://api.polyv.net/live/v3/channel/statistics/daily/summary
Request Method
GET
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
The time span between the start date and end date must not exceed 60 days.
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 never 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 |
| channelId | true | String | Channel ID |
| startDay | true | String | Start date, format: yyyy-MM-dd |
| endDay | true | String | End date, format: yyyy-MM-dd |
Example
http://api.polyv.net/live/v3/channel/statistics/daily/summary?startDay=2021-6-1&appId=frlr1zazn3&endDay=2021-7-11&sign=3A891F01997FC54E486A1807C6E6DBF6&channelId=1965681×tamp=1652410270091
Response Parameter Description
| Field | Type | Description |
|---|---|---|
| status | String | Status value |
| result | Array | Corresponding result See Result parameter description |
Result Parameter Description
| Parameter | Type | Description |
|---|---|---|
| currentDay | String | Query date, format: yyyy-MM-dd |
| channelId | String | Channel ID |
| userId | String | Live account ID |
| pcPlayDuration | Integer | PC playback duration, unit: minutes |
| pcVideoView | Integer | Total PC views, similar to PV |
| pcUniqueViewer | Integer | Unique PC viewers, similar to UV |
| mobilePlayDuration | Integer | Mobile playback duration, unit: minutes |
| mobileVideoView | Integer | Total mobile views, similar to PV |
| mobileUniqueViewer | Integer | Unique mobile viewers, similar to UV |
| createdTime | Long | Record creation time, 13-digit millisecond timestamp |
| lastModified | Long | Record modification time, 13-digit millisecond timestamp |
| creatorId | String | Sub-account user ID of the creating account (empty if created by the main account) |
| creatorName | String | Sub-account name of the channel creator (displays "Main Account" if created by the main account) |
Java Request Example
For quick integration of the basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source 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 testSummary() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v3/channel/statistics/daily/summary";
String channelId = "1965681";
String startDay = "2021-6-1";
String endDay = "2021-7-11";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
requestMap.put("startDay",startDay);
requestMap.put("endDay",endDay);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道某段时间的直播观看详情数据,返回值:{}",response);
//do somethings
}
Response Example
For global system error descriptions, see Global Error Description
Success Example
{
"status":"success",
"result":[
{
"currentDay":"2020-10-20",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":7,
"pcVideoView":7,
"pcUniqueViewer":1,
"mobilePlayDuration":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"createdTime":1603218100000,
"lastModified":1603218100000,
"creatorId":"1b448be323",
"creatorName":"主账号"
},
{
"currentDay":"2020-10-26",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":17,
"pcVideoView":12,
"pcUniqueViewer":1,
"mobilePlayDuration":2,
"mobileVideoView":1,
"mobileUniqueViewer":1,
"createdTime":1603736505000,
"lastModified":1603736505000,
"creatorId":"1b448be323",
"creatorName":"主账号"
},
{
"currentDay":"2020-11-12",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":1,
"pcVideoView":1,
"pcUniqueViewer":1,
"mobilePlayDuration":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"createdTime":1605205271000,
"lastModified":1605205271000,
"creatorId":"1b448be323",
"creatorName":"主账号"
},
{
"currentDay":"2020-12-03",
"channelId":1965681,
"userId":"1b448be323",
"pcPlayDuration":1,
"pcVideoView":1,
"pcUniqueViewer":1,
"mobilePlayDuration":0,
"mobileVideoView":0,
"mobileUniqueViewer":0,
"createdTime":1607019680000,
"lastModified":1607019680000,
"creatorId":"1b448be323",
"creatorName":"主账号"
}
]
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
