Query Channel Session Information
Updated: 2022-09-02 18:08:07
API Description
1、查询频道直播场次信息
2、接口支持https协议
API URL
http://api.polyv.net/live/v3/channel/session/list
<a href="/req.html?api=http://api.polyv.net/live/v3/channel/session/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
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See Get Secret Key |
| 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 saved or used directly on the client. All APIs must be called through the customer's own server to relay requests to the POLYV server and obtain response data. See Signature Generation Rules |
| channelId | true | String | Channel ID |
| startDate | false | String | Start date, 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, 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, defaults to 1 |
| pageSize | false | String | Number of data items per page, defaults to 20 |
Example
https://api.polyv.net/live/v3/channel/session/list?endDate=2021-01-01&appId=frlr1zazn3&sign=A7743F8014514A865F73D11A006606C1&pageSize=10&page=1&channelId=2191532&startDate=2020-01-01×tamp=1621841156849
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 | Empty on failure. On success, contains channel live session information. See data field description |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| pageSize | Integer | Number of items per page |
| pageNumber | Integer | Current page number |
| totalItems | Integer | Total number of items |
| contents | Array | Query result list See Contents Parameter Description |
| startRow | Integer | Position of the first record on the current page in 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 items per page |
| totalPages | Integer | Total number of pages |
| endRow | Integer | Position of the last record on the current page in 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. Retrieval path: Official website -> Login -> Live (Development Settings) |
| startTime | Long | Live start time, 13-digit millisecond timestamp |
| endTime | Long | Live end time, 13-digit millisecond timestamp |
Java Request Example
For quick integration of 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 functionality 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/list";
String channelId = "2191532";
String startDate = "2020-01-01";
String endDate = "2021-01-01";
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":20,
"pageNumber":1,
"totalItems":1,
"contents":[
{
"sessionId":"fwmnnydr06",
"channelId":2191532,
"userId":"1b448be323",
"startTime":1615450395000,
"endTime":1615450509000
}
],
"startRow":1,
"firstPage":true,
"lastPage":true,
"prePageNumber":1,
"limit":1,
"endRow":1,
"nextPageNumber":1,
"totalPages":1,
"offset":0
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
