channelSession
Updated: 2025-09-11 15:18:09
1. Query Channel Session Information
Description
查询频道直播场次信息
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/session/data/list
Call Constraints
Unit Test
@Test
public void testGetSessionList() throws IOException, NoSuchAlgorithmException {
LiveSessionListRequest liveSessionListRequest = new LiveSessionListRequest();
LiveSessionListResponse liveSessionListResponse;
try {
String channelId = super.createChannel();
liveSessionListRequest.setChannelId(channelId);
liveSessionListRequest.setStartDate(super.getDate(2022, 07, 01));
liveSessionListRequest.setEndDate(super.getDate(2022, 07, 22));
liveSessionListResponse = new LiveChannelSessionServiceImpl().getSessionList(liveSessionListRequest);
Assert.assertNotNull(liveSessionListResponse);
if (liveSessionListResponse != null) {
//to do something ......
log.debug("测试查询频道场次信息成功 {}", JSON.toJSONString(liveSessionListResponse));
}
} catch (PloyvSdkException e) {
//参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage()
log.error(e.getMessage(), e);
// 异常返回做B端异常的业务逻辑,记录log 或者 上报到ETL 或者回滚事务
throw e;
} catch (Exception e) {
log.error("SDK调用异常", e);
throw e;
}
}
Unit Test Description
If the request is correct, a LiveSessionListResponse object is returned. The B-side processes business logic based on this object.
If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields [pic cannot be empty / msg cannot be empty] ].
If the server encounters an exception, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [ Error returned from Polyv request data, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| startDate | false | Date | 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 | Date | 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 data items per page, default is 20 |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account invocation). Obtain it by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings). |
| appSecret | false | String | POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account invocation). Obtain it by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings). |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| contents | Array | Query result list [see SessionInfo Parameter Description for details] |
| pageSize | Integer | Number of data items per page, default is 20 |
| currentPage | Integer | Current page [corresponds to the pageNumber field in the API documentation] |
| totalItems | Integer | Total number of records |
| totalPage | Integer | Total number of pages [corresponds to the totalPages field in the API documentation] |
SessionInfo 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. Obtain it via: Official website -> Login -> Live Streaming (Development Settings). |
| startTime | Date | Live start time |
| endTime | Date | Live end time |
