checkinService
1. Query Check-in Results
Description
查询签到结果
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/checkin/list
Call Constraints
- The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
Unit Test
@Test
public void testGetCheckinListInfo() throws Exception, NoSuchAlgorithmException {
LiveCheckinListRequest liveCheckinListRequest = new LiveCheckinListRequest();
LiveCheckinListResponse liveCheckinListResponse = null;
try {
String channelId = super.createChannel();
liveCheckinListRequest.setChannelId(channelId);
liveCheckinListRequest.setDate(getDate(2020,10,20)).setSessionId("fs9v9y4nxf");
liveCheckinListResponse = new LiveCheckinServiceImpl().getCheckinListInfo(liveCheckinListRequest);
Assert.assertNotNull(liveCheckinListResponse);
if (liveCheckinListResponse != null) {
//to do something ......
log.debug("测试查询签到结果成功{}", JSON.toJSONString(liveCheckinListResponse));
}
} 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
LiveCheckinListResponseobject is returned. The B-end processes business logic based on this object.If the request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), for example: [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].If the server encounters an exception during processing, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), for example: [Error returned by Polyv request, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| date | false | Date | Specified query date, format: yyyy-MM-dd. Defaults to the current day's check-in records. |
| sessionId | false | String | Session ID. sessionId has higher priority than date. If sessionId is provided, the date parameter is ignored. |
| currentPage | false | Integer | Page number, defaults to 1. [Corresponds to the page field in the API documentation] |
| pageSize | false | Integer | Number of data items per page, defaults to 20. |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtained 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). Obtained by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
| Parameter | Type | Description |
|---|---|---|
| contents | Array | Array of check-in record data. See CheckinRecord Parameter Description for details |
| pageSize | Integer | Number of data items per page, defaults to 20. |
| currentPage | Integer | Current page number. [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] |
CheckinRecord Parameter Description
| Parameter | Type | Description |
|---|---|---|
| indate | Date | Check-in date queried, format: yyyy-MM-dd. |
| nickname | String | Nickname. |
| userId | String | C-end viewer ID. [Corresponds to the userid field in the API documentation] |
| channelId | String | Channel ID. |
| time | Date | Check-in time. |
| timeFormat | Date | Formatted detailed check-in date, format: yyyy-MM-dd HH:mm. |
| sessionId | String | Session ID. |
| checkinid | String | Check-in ID. One check-in per session. |
| id | String | Primary key of the check-in record. |
| startTime | Date | Start time of the live session. This field has a value only if the sessionId parameter is provided in the request. |
| param4 | String | Custom parameter passed during external authorization or direct (standalone) authorization. |
| param5 | String | Custom parameter passed during external authorization or direct (standalone) authorization. |
2. Query Check-in Records by Specified Check-in ID
Description
通过签到ID获取该次签到记录
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/chat/get-checkins
Call Constraints
- The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
Unit Test
@Test
public void testGetCheckinInfoById() throws Exception, NoSuchAlgorithmException {
LiveCheckinRequest liveCheckinRequest = new LiveCheckinRequest();
List<LiveCheckinResponse> liveCheckinResponse = null;
try {
String channelId = super.createChannel();
liveCheckinRequest.setChannelId(channelId)
.setCheckinId("d91a7c60-1299-11eb-8c65-c70c1c");
liveCheckinResponse = new LiveCheckinServiceImpl().getCheckinInfoById(liveCheckinRequest);
Assert.assertNotNull(liveCheckinResponse);
if (liveCheckinResponse != null) {
//to do something ......
log.debug("测试查询指定签到ID的签到记录成功{}", JSON.toJSONString(liveCheckinResponse));
}
} 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
LiveCheckinResponseobject is returned. The B-end processes business logic based on this object.If the request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), for example: [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].If the server encounters an exception during processing, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), for example: [Error returned by Polyv request, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| checkinId | true | String | Check-in ID |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtained 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). Obtained by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
The return object is List<LiveCheckinResponse>. The specific elements of LiveCheckinResponse are as follows:
| Parameter | Type | Description |
|---|---|---|
| checkinid | String | Check-in ID |
| nickname | String | Name of the check-in participant |
| checked | String | Y for checked in, N for not checked in |
| indate | Date | Check-in date, format: yyyy-MM-dd |
| id | Integer | Primary key of the check-in record |
| sessionId | String | Session ID |
| time | Date | Check-in time |
| userid | String | Check-in participant ID |
| roomid | String | Room ID |
| param4 | String | Custom parameter passed during external authorization or direct (standalone) authorization |
| param5 | String | Custom parameter passed during external authorization or direct (standalone) authorization |
3. Query Check-in Session Information by Specified Live Session ID
Description
通过直播场次sessionId获取直播发起签到记录
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/chat/checkin-by-sessionId
Call Constraints
- The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.
Unit Test
@Test
public void testGetCheckinMetadataBySessionId() throws Exception, NoSuchAlgorithmException {
LiveCheckinMetadataBySessionIdRequest liveCheckinMetadataBySessionIdRequest =
new LiveCheckinMetadataBySessionIdRequest();
List<LiveCheckinMetadataBySessionIdResponse> liveCheckinResponse = null;
try {
String channelId = super.createChannel();
liveCheckinMetadataBySessionIdRequest.setChannelId(channelId)
.setSessionId("fs9v9y4nxf");
liveCheckinResponse = new LiveCheckinServiceImpl().getCheckinMetadataBySessionId(
liveCheckinMetadataBySessionIdRequest);
Assert.assertNotNull(liveCheckinResponse);
if (liveCheckinResponse != null) {
//to do something ......
log.debug("测试依据指定直播场次sessionId查询签到场次信息成功{}", JSON.toJSONString(liveCheckinResponse));
}
} 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
LiveCheckinMetadataBySessionIdResponseobject is returned. The B-end processes business logic based on this object.If the request parameter validation fails, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), for example: [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].If the server encounters an exception during processing, a
PloyvSdkExceptionis thrown. The error message can be found inPloyvSdkException.getMessage(), for example: [Error returned by Polyv request, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| channelId | true | String | Channel ID |
| sessionId | true | String | Session ID |
| appId | false | String | POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called). Obtained 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). Obtained by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings). |
Return Object Description
The return object is List<LiveCheckinMetadataBySessionIdResponse>. The specific elements of LiveCheckinMetadataBySessionIdResponse are as follows:
| Parameter | Type | Description |
|---|---|---|
| createtime | Date | Check-in time |
| checkinid | String | Check-in ID |
| sessionId | String | Session ID |
| roomid | String | Room ID |
| forceCheckInEnabled | String | Whether forced check-in is enabled |
| isPlayback | String | 0: Check-in not during playback, 1: Check-in during playback |
