Query Channel Session Information
API Description
1、查询频道直播场次信息
2、接口支持https协议
API URL
http://api.polyv.net/live/v3/channel/session/data/list
<a href="/req.html?api=http://api.polyv.net/live/v3/channel/session/data/list"" target="_blank">Online API Call
Request Method
GET
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. API calls have frequency limits. See details
The time span between the start date and end date must not exceed 60 days. If not provided, the default query is for the last 60 days.
Live sessions that are currently in progress will also be returned, with
endTimebeing null.
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 API calls must be relayed through your own server to the POLYV server for response data. See signature generation rules |
| channelId | true | String | Channel ID |
| startDate | false | String | Start date of the live session, format: yyyy-MM-dd HH:mm:ss. If the time is 00:00:00, the format yyyy-MM-dd is also supported. |
| endDate | false | String | End date of the live session, format: yyyy-MM-dd HH:mm:ss. If the time is 00:00:00, the format yyyy-MM-dd is also supported. |
| page | false | String | Page number, default is 1 |
| pageSize | false | String | Number of records per page, default is 20 |
Example
https://api.polyv.net/live/v3/channel/session/data/list?appId=frlr1zazn3&sign=70DF5378E04B103CCCEA048260C75EDD&pageSize=10&page=1&channelId=2272655×tamp=1652411923329
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 | Object | Null on failure. On success, contains channel live session information. See data field description |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| pageSize | Integer | Number of records per page |
| pageNumber | Integer | Current page number |
| totalItems | Integer | Total number of records |
| contents | Array | Query result list See Contents parameter description |
| startRow | Integer | Position of the first record on the current page within the total result set |
| firstPage | Boolean | Whether it is the first page, value: true/false |
| lastPage | Boolean | Whether it is the last page, value: true/false |
| prePageNumber | Integer | Previous page number |
| nextPageNumber | Integer | Next page number |
| limit | Integer | Number of records per page |
| totalPages | Integer | Total number of pages |
| endRow | Integer | Position of the last record on the current page within the total result set |
| offset | Integer | Pagination starting record |
Contents Parameter Description
| Parameter | Type | Description |
|---|---|---|
| channelId | String | Channel ID |
| sessionId | String | Live session ID |
| userId | String | POLYV user ID, consistent with the Polyv official website. Access path: Official website -> Login -> Live (Development Settings) |
| startTime | Long | Live session start time, 13-digit millisecond timestamp |
| endTime | Long | Live session end time, 13-digit millisecond timestamp |
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 code project. The test cases include HttpUtil.java and LiveSignUtil.java, both contained in the download 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(ChannelPlayBackTest.class);
/**
* 查询频道直播场次信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetChannelSessions() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "https://api.polyv.net/live/v3/channel/session/data/list";
String channelId = "2272655";
String page = "1";
String pageSize = "10";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("startDate", startDate);
requestMap.put("endDate", endDate);
requestMap.put("page", page);
requestMap.put("pageSize", pageSize);
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
{
"code": 200,
"status": "success",
"message": "",
"data": {
"pageSize": 10,
"pageNumber": 1,
"totalItems": 4,
"contents": [
{
"sessionId": "g9lv2ghv2x",
"channelId": 2272655,
"userId": "1b448be323",
"startTime": 1652062574000,
"endTime": 1652062643000,
"customId": null
},
{
"sessionId": "g9b3pwv2b7",
"channelId": 2272655,
"userId": "1b448be323",
"startTime": 1651219401000,
"endTime": 1651219592000,
"customId": null
},
{
"sessionId": "g8ms75epoj",
"channelId": 2272655,
"userId": "1b448be323",
"startTime": 1649313582000,
"endTime": 1649313757000,
"customId": null
},
{
"sessionId": "g87lv4kjh2",
"channelId": 2272655,
"userId": "1b448be323",
"startTime": 1648124333000,
"endTime": 1648124412000,
"customId": null
}
],
"limit": 4,
"nextPageNumber": 1,
"startRow": 1,
"firstPage": true,
"lastPage": true,
"prePageNumber": 1,
"endRow": 4,
"totalPages": 1,
"offset": 0
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
