Polyv Help Center

Help Center

webAuth

Updated: 2025-12-17 11:29:24

1. Add a Single Whitelist Entry

Description

添加单个白名单
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/add-white-list

Call Constraints

  1. The API call is subject to rate limits. For details, see here. For common call exceptions, see here.

Unit Testing

    @Test
    public void testCreateChannelWhiteList() throws Exception, NoSuchAlgorithmException {
        LiveCreateChannelWhiteListRequest liveCreateChannelWhiteListRequest = new LiveCreateChannelWhiteListRequest();
        Boolean liveCreateChannelWhiteListResponse;
        try {
            liveCreateChannelWhiteListRequest.setRank(1)
                    .setCode(String.valueOf(System.currentTimeMillis()))
                    .setName("学员1");
            liveCreateChannelWhiteListResponse = new LiveWebAuthServiceImpl().createChannelWhiteList(
                    liveCreateChannelWhiteListRequest);
            Assert.assertNotNull(liveCreateChannelWhiteListResponse);
            if (liveCreateChannelWhiteListResponse) {
                //to do something ......
                log.debug("测试添加单个白名单-全局白名单成功");
            }
        } 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 Testing Instructions

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields: [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId false String Channel ID (if provided, adds the channel to the watch whitelist; if not provided, adds to the global watch whitelist)
rank true Integer Primary watch condition is 1, secondary watch condition is 2
code true String Membership code (maximum 50 characters)
name false String Nickname (maximum 50 characters)
appId false String POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings)

Return Object Description

true indicates successful addition, false indicates failed addition




2. Query Channel Watch Whitelist

Description

查询频道观看白名单列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/get-white-list

Call Constraints

  1. The API call is subject to rate limits. Click here for details. For common call exceptions, click here for details.

Unit Testing

    @Test
    public void testGetChannelWhiteList() throws Exception, NoSuchAlgorithmException {
        LiveChannelWhiteListRequest liveChannelWhiteListRequest = new LiveChannelWhiteListRequest();
        LiveChannelWhiteListResponse liveChannelWhiteListResponse;
        try {
            liveChannelWhiteListRequest.setChannelId(null)
                    .setRank(1)
                    .setKeyword(null)
                    .setPageSize(1);
            liveChannelWhiteListResponse = new LiveWebAuthServiceImpl().getChannelWhiteList(
                    liveChannelWhiteListRequest);
            Assert.assertNotNull(liveChannelWhiteListResponse);
            if (liveChannelWhiteListResponse != null) {
                //to do something ......
                log.debug("测试查询频道观看白名单列表成功,{}", JSON.toJSONString(liveChannelWhiteListResponse));
            }
        } 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 Testing Description

  1. If the request is correct, a LiveChannelWhiteListResponse object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Name Required Type Description
channelId false String Channel ID; if not provided, global settings are retrieved
rank true Integer 1 for primary condition, 2 for secondary condition
keyword false String Keyword for querying by membership code or name
currentPage false Integer Page number, defaults to 1 (corresponds to the page field in the API documentation)
pageSize false Integer Number of data items displayed per page, defaults to 20
appId false String POLYV user APP_ID; required for multi-account calls (i.e., when initMultiAccount() is invoked). 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 invoked). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings)

Return Object Description

Parameter Name Type Description
contents Array Whitelist list [See ChannelWhiteList Parameter Description for details]
pageSize Integer Number of data items displayed per page, default is 20 items per page
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]
ChannelWhiteList Parameter Description
Parameter Type Description
name String Nickname (or alias)
phone String Membership code






3. Query Live Channel Viewing Conditions

Description

查询直播频道观看条件
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/get

Call Constraints

  1. The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testGetChannelAuth() throws Exception, NoSuchAlgorithmException {
        LiveChannelAuthRequest liveChannelAuthRequest = new LiveChannelAuthRequest();
        LiveChannelAuthResponse liveChannelAuthResponse;
        try {
            liveChannelAuthRequest.setChannelId(createChannel());
            liveChannelAuthResponse = new LiveWebAuthServiceImpl().getChannelAuth(liveChannelAuthRequest);
            Assert.assertNotNull(liveChannelAuthResponse);
            if (liveChannelAuthResponse != null) {
                //to do something ......
                log.debug("测试查询直播频道观看条件成功,{}", JSON.toJSONString(liveChannelAuthResponse));
            }
        } 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 Testing Description

  1. If the request is correct, a LiveChannelAuthResponse object is returned, and the B-side processes the business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. See PloyvSdkException.getMessage() for error details, e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId false String Channel ID. If not provided, the global viewing conditions will be retrieved.
appId false String POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up 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. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings).

Return Object Description

Parameter Name Type Description
authSettings Array Viewing conditions [See AuthSetting Parameter Description]
AuthSetting Parameter Description
Parameter Name Type Description
rank Integer General parameter: 1 for primary viewing condition, 2 for secondary viewing condition
enabled String General parameter: whether enabled, Y for enabled, N for disabled
authType String General parameter: pay-per-view - pay, verification code viewing - code, whitelist viewing - phone, registration viewing - info, custom authorization viewing - custom, external authorization - external, direct authorization - direct
subAuthType String Corresponding value when authType is none: public - public viewing, wx - WeChat authorization
wxAuthExpireValue String When subAuthType is wx, the corresponding WeChat authorization validity period, e.g., 3d means 3 days, 3h means 3 hours
payAuthTips String Pay-per-view parameter: welcome title
price Float Pay-per-view parameter: price, in yuan
watchEndTime Date Pay-per-view parameter: paid validity end date. When both watchEndTime and validTimePeriod are empty, it means paid permanently valid
validTimePeriod Integer Pay-per-view parameter: paid validity duration, in days. When both watchEndTime and validTimePeriod are empty, it means paid permanently valid
authCode String Verification code viewing parameter: verification code
qcodeTips String Verification code viewing parameter: prompt text
qcodeImg String Verification code viewing parameter: QR code URL of the official account
authTips String When authType is phone, set parameter, optional. Prompt text
whiteListEntryText String When authType is phone, set parameter, optional. Whitelist entry text
whiteListInputTips String When authType is phone, set parameter, optional. Whitelist input prompt
infoFields Array Registration viewing parameter, maximum of 5 [see InfoField parameter description]
infoAuthTips String When authType is info, set parameter, optional. Welcome title
infoDesc String When authType is info, set parameter, optional. Prompt information
infoEntryText String When authType is info, set parameter, optional. Entry text
externalKey String External authorization parameter: SecretKey
externalUri String External authorization parameter: custom URL
externalRedirectUri String External authorization parameter: redirect URL
externalEntryText String External authorization viewing, entry text
externalButtonEnabled String External authorization viewing, login button. Y for enabled, N for disabled. When enabled, the guide page will display a login button when users access the link
customKey String Custom authorization parameter: SecretKey
customUri String Custom authorization parameter: custom URL
directKey String Direct authorization parameter: direct authorization SecretKey
codeAuthTips String Password viewing condition prompt information
codeEntryText String Password viewing entry text
payEntryText String Pay entry text
expectedArrivalEnabled String Whitelist viewing attendance list switch, Y - on, N - off, default is N
onceWhitelistEnabled String Whitelist viewing does not allow reuse, default is N, Y: yes, N: no
privacyStatus String Whether to enable privacy statement, Y - on, N - off, default is N
privacyContent String Privacy statement content
inviteWatchAuditEnabled String Invite viewing audit switch, Y - on, N - off, default is N
InfoField Parameter Description
Parameter Type Description
name String Registration information name, up to 8 characters
type String Registration type: name - name, text - text, mobile - mobile, number - number, option - dropdown. This field is required when registering for viewing.
options String For dropdown options, the option values separated by English commas. Maximum of 8 options; each option content is up to 8 characters.
placeholder String Input prompt for text box, up to 8 characters
sms String SMS verification toggle: Y for enabled, N for disabled






4. Setting Viewing Conditions

Description

设置观看条件
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/update

Call Constraints

  1. The API call is subject to rate limits. Click here for details. For common call exceptions, click here.

Unit Testing

    @Test
    public void testUpdateChannelAuth() throws Exception, NoSuchAlgorithmException {
        LiveUpdateChannelAuthRequest liveUpdateChannelAuthRequest = new LiveUpdateChannelAuthRequest();
        Boolean liveUpdateChannelAuthResponse;
        try {
            LiveChannelSettingRequest.AuthSetting authSetting = new LiveChannelSettingRequest.AuthSetting().setAuthType(
                    LiveConstant.AuthType.CODE.getDesc())
                    .setRank(1)
                    .setEnabled("Y")
                    .setAuthCode("123456")
                    .setQcodeTips("提示文案测试2")
                    .setQcodeImg("https://live.polyv.net/static/images/live-header-logo.png");
            List<LiveChannelSettingRequest.AuthSetting> authSettings =
                    new ArrayList<LiveChannelSettingRequest.AuthSetting>();
            authSettings.add(authSetting);
            LiveChannelSettingRequest.AuthSetting authSetting2 = new LiveChannelSettingRequest.AuthSetting().setAuthType(
                    LiveConstant.AuthType.DIRECT.getDesc())
                    .setRank(2)
                    .setEnabled("N")
                    //此处随机生成独立授权秘钥,对接时根据实际情况设置
                    .setDirectKey(super.getRandomString(10));
            authSettings.add(authSetting2);
            liveUpdateChannelAuthRequest.setChannelId(createChannel())
                    .setAuthSettings(authSettings);
            liveUpdateChannelAuthResponse = new LiveWebAuthServiceImpl().updateChannelAuth(
                    liveUpdateChannelAuthRequest);
            Assert.assertNotNull(liveUpdateChannelAuthResponse);
            if (liveUpdateChannelAuthResponse) {
                log.debug("测试设置观看条件成功");
            }
        } 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 Testing Instructions

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId false String Channel ID; if not provided, it is a global setting
authSettings true Array Viewing condition settings [See AuthSetting Parameter Description]
appId false String POLYV user APP_ID; required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). 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 to set up multi-account calls). Obtained by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings)
AuthSetting Parameter Description
Parameter Name Required Type Description
rank true Integer General parameter: 1 for primary viewing condition, 2 for secondary viewing condition
enabled true String General parameter: Whether enabled, Y for enabled, N for disabled
authType false String General parameter: Pay to view - pay, verification code to view - code, whitelist to view - phone, registration to view - info, custom authorization to view - custom, external authorization - external, direct authorization - direct
subAuthType false String Corresponding value when authType is none: public - public viewing, wx - WeChat authorization
wxAuthExpireValue false String When subAuthType is wx, the corresponding WeChat authorization validity period, e.g., 3d for 3 days, 3h for 3 hours
payAuthTips false String Pay to view parameter: Welcome title
price false Float Pay to view parameter: Price, in yuan
watchEndTime false Date Pay to view parameter: Payment validity end date. When both watchEndTime and validTimePeriod are empty, payment is permanently valid
validTimePeriod false Integer Pay to view parameter: Payment validity duration, in days. When both watchEndTime and validTimePeriod are empty, payment is permanently valid
authCode false String Verification code to view parameter: Verification code
qcodeTips false String Verification code to view parameter: Prompt text
qcodeImg false String Verification code to view parameter: Official account QR code URL
authTips false String When authType is phone, set parameter, optional. Prompt text
whiteListEntryText false String When authType is phone, set parameter, optional. Whitelist entry text
whiteListInputTips false String When authType is phone, set parameter, optional. Whitelist input prompt
infoFields false Array Registration to view parameter, maximum of 5 [See InfoField parameter description]
infoAuthTips false String When authType is info, set parameter, optional. Welcome title
infoDesc false String When authType is info, set parameter, optional. Prompt information
infoEntryText false String When authType is info, set parameter, optional. Entry text
externalKey false String External authorization parameter: SecretKey
externalUri false String External authorization parameter: Custom URL
externalRedirectUri false String External authorization parameter: Redirect URL
externalEntryText false String External authorization viewing, entry text
externalButtonEnabled false String External authorization viewing, login button. Y for enabled, N for disabled. When enabled, the landing page will display a login button when users access the link
customKey false String Custom authorization parameter: SecretKey
customUri false String Custom authorization parameter: Custom URL
directKey false String Direct authorization: Authorization SecretKey
directRedirectUri false String Direct authorization parameter: Authorization failure URL
codeAuthTips false String Password viewing condition prompt text
codeEntryText false String Password viewing entry text
payEntryText false String Pay entry text
expectedArrivalEnabled false String Whitelist viewing attendance list switch, Y - on, N - off, default N
onceWhitelistEnabled false String Whitelist viewing does not allow reuse, default N, Y: yes, N: no
privacyStatus false String Whether to enable privacy statement, Y - on, N - off, default N
privacyContent false String Privacy statement content
inviteWatchAuditEnabled false String Invitation viewing audit switch, Y - on, N - off, default N
InfoField Parameter Description
Parameter Required Type Description
name false String Registration info name, up to 8 characters
type true String Registration type: name - name, text - text, mobile - mobile number, number - number, option - dropdown option. This field is required when registering for viewing.
options false String For dropdown options, the option values separated by commas. Maximum of 8 options; each option up to 8 characters
placeholder false String Input box placeholder text, up to 8 characters
sms false String SMS verification toggle: Y for enabled, N for disabled

Return Object Description

true indicates that the viewing condition was set successfully, while false indicates that the setting failed.





5. Setting External Authorization via API

Description

通过接口设置外部授权
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelSetting/%s/auth-external

Call Constraints

  1. API calls are subject to rate limits. See details. For common call exceptions, see details.

Unit Testing

    @Test
    public void testUpdateChannelAuthExternal() throws Exception, NoSuchAlgorithmException {
        LiveChannelAuthExternalRequest liveChannelAuthExternalRequest = new LiveChannelAuthExternalRequest();
        LiveChannelAuthExternalResponse liveChannelAuthExternalResponse;
        try {
            liveChannelAuthExternalRequest.setChannelId(createChannel())
                    .setExternalUri("https://help.polyv.net/");
            liveChannelAuthExternalResponse = new LiveWebAuthServiceImpl().updateChannelAuthExternal(
                    liveChannelAuthExternalRequest);
            Assert.assertNotNull(liveChannelAuthExternalResponse);
            if (liveChannelAuthExternalResponse != null) {
                //to do something ......
                log.debug("测试通过接口设置外部授权成功,{}", JSON.toJSONString(liveChannelAuthExternalResponse));
            }
        } 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 Testing Instructions

  1. If the request is correct, a LiveChannelAuthExternalResponse object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
userId false String POLYV user ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings).
channelId false String Channel ID. If provided, settings apply to the specified channel; if not provided, settings apply to all channels under the account.
externalUri true String URL for the user information retrieval interface.
appId false String POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up 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. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings).

Return Object Description

Parameter Name Type Description
channelAuthExternals Array External authorization [See ChannelAuthExternal Parameter Description]
ChannelAuthExternal Parameter Description
Parameter Name Type Description
channelId String The set channel number
secretKey String The secretKey for external authorization corresponding to the channel number






6. Setting a Custom Authorization Address

Description

设置自定义授权地址
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelSetting/%s/oauth-custom

Invocation Constraints

  1. The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common invocation exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testUpdateChannelAuthCustom() throws Exception, NoSuchAlgorithmException {
        LiveChannelAuthCustomRequest liveChannelAuthCustomRequest = new LiveChannelAuthCustomRequest();
        LiveChannelAuthCustomResponse liveChannelAuthCustomResponse;
        try {
            liveChannelAuthCustomRequest.setChannelId(createChannel())
                    .setCustomUri("https://help.polyv.net/");
            liveChannelAuthCustomResponse = new LiveWebAuthServiceImpl().updateChannelAuthCustom(
                    liveChannelAuthCustomRequest);
            Assert.assertNotNull(liveChannelAuthCustomResponse);
            if (liveChannelAuthCustomResponse != null) {
                //to do something ......
                log.debug("测试设置自定义授权地址成功,{}", JSON.toJSONString(liveChannelAuthCustomResponse));
            }
        } 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 Testing Description

  1. If the request is correct, a LiveChannelAuthCustomResponse object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
userId false String POLYV user ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings).
channelId false String Channel ID. If submitted, the setting applies to that specific channel; if not submitted, the setting applies to all channels under the account.
customUri true String Custom authorization address.
appId false String POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up 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. This parameter is required for multi-account calls (i.e., when initMultiAccount() has been called to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings).

Return Object Description

Parameter Name Type Description
channelAuthExternals Array External authorization [See ChannelAuthExternal Parameter Description]
ChannelAuthExternal Parameter Description
Parameter Name Type Description
channelId String The channel ID to be set
secretKey String The secretKey corresponding to the custom authorization for the channel ID






7. Set Authorization URL

Description

设置授权认证URL
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/restrict/update-auth-url

Call Constraints

  1. The API call is subject to frequency limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testUpdateChannelAuthUrl() throws Exception, NoSuchAlgorithmException {
        LiveUpdateChannelAuthUrlRequest liveUpdateChannelAuthUrlRequest = new LiveUpdateChannelAuthUrlRequest();
        Boolean liveUpdateChannelAuthUrlResponse;
        try {
            liveUpdateChannelAuthUrlRequest.setChannelId(createChannel())
                    .setUrl("http://www.polyv.net");
            liveUpdateChannelAuthUrlResponse = new LiveWebAuthServiceImpl().updateChannelAuthUrl(
                    liveUpdateChannelAuthUrlRequest);
            Assert.assertNotNull(liveUpdateChannelAuthUrlResponse);
            if (liveUpdateChannelAuthUrlResponse != null) {
                //to do something ......
                log.debug("测试设置授权认证URL成功");
            }
        } 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 Testing Instructions

  1. If the request is correct, a Boolean object is returned. The B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId false String Channel ID; if absent, it is a global setting
url false String Authorization URL; leave empty to clear the setting
appId false String POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up 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. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings)

Return Object Description

true indicates success, false indicates failure.





8. Set Authorized Viewing Type

Description

设置授权观看类型
接口地址(仅做说明使用):https://api.polyv.net/live/v2/channelSetting/%s/set-auth-type

Call Constraints

  1. The API call is subject to rate limits. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testUpdateChannelAuthType() throws Exception, NoSuchAlgorithmException {
        LiveChannelAuthTypeRequest liveChannelAuthTypeRequest = new LiveChannelAuthTypeRequest();
        Boolean liveChannelAuthTypeResponse;
        try {
            liveChannelAuthTypeRequest.setChannelId(createChannel())
                    .setAuthType("none");
            liveChannelAuthTypeResponse = new LiveWebAuthServiceImpl().updateChannelAuthType(
                    liveChannelAuthTypeRequest);
            Assert.assertTrue(liveChannelAuthTypeResponse);
            if (liveChannelAuthTypeResponse) {
                //to do something ......
                log.debug("测试设置授权观看类型成功");
            }
        } 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 Testing Instructions

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
authType true String Viewing condition type, default value is none (viewing condition disabled)
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up 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 to set up multi-account invocation). Obtain it by registering on the POLYV official website: Official Website -> Login -> Live Streaming (Development Settings)

Return Object Description

true indicates authorization success, false indicates authorization failure.





9. Update Whitelist

Description

更新白名单
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/update-white-list

Call Constraints

  1. The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.

Unit Testing

    @Test
    public void testUpdateChannelWhiteList() throws Exception, NoSuchAlgorithmException {
        LiveUpdateChannelWhiteListRequest liveUpdateChannelWhiteListRequest = new LiveUpdateChannelWhiteListRequest();
        Boolean liveUpdateChannelWhiteListResponse;
        try {
            liveUpdateChannelWhiteListRequest.setChannelId(null)
                    .setRank(1)
                    .setOldCode("1605067278063")
                    .setCode("1605067278063")
                    .setName("学员2");
            liveUpdateChannelWhiteListResponse = new LiveWebAuthServiceImpl().updateChannelWhiteList(
                    liveUpdateChannelWhiteListRequest);
            Assert.assertNotNull(liveUpdateChannelWhiteListResponse);
            if (liveUpdateChannelWhiteListResponse) {
                //to do something ......
                log.debug("测试更新白名单成功");
            }
        } 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 Testing Instructions

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. See PloyvSdkException.getMessage() for error details, e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId false String Channel ID (if provided, modifies the channel's viewing whitelist; if not provided, modifies the global viewing whitelist)
rank true Integer Primary viewing condition is 1, secondary viewing condition is 2
oldCode true String Old membership code
code true String Membership code (maximum 50 characters)
name false String Nickname (maximum 50 characters)
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account invocation). 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 to set up multi-account invocation). Obtained by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings)

Return Object Description

true indicates a successful update, false indicates a failure.





10. Delete Whitelist

Description

用于删除指定观看白名单(支持一键清空)
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/delete-white-list

Call Constraints

  1. The API call is subject to frequency limits. Click here for details. For common call exceptions, click here for details.

Unit Testing

    @Test
    public void testDeleteChannelWhiteList() throws Exception, NoSuchAlgorithmException {
        LiveDeleteChannelWhiteListRequest liveDeleteChannelWhiteListRequest = new LiveDeleteChannelWhiteListRequest();
        Boolean liveDeleteChannelWhiteListResponse;
        try {
            liveDeleteChannelWhiteListRequest.setChannelId(null)
                    .setRank(1)
                    .setIsClear("N")
                    .setCode("1605052902421");
            liveDeleteChannelWhiteListResponse = new LiveWebAuthServiceImpl().deleteChannelWhiteList(
                    liveDeleteChannelWhiteListRequest);
            Assert.assertNotNull(liveDeleteChannelWhiteListResponse);
            if (liveDeleteChannelWhiteListResponse) {
                //to do something ......
                log.debug("测试删除白名单成功");
            }
        } 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 Testing Instructions

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId false String Channel ID (if provided, modifies the channel's viewing whitelist; if omitted, modifies the global viewing whitelist)
rank true Integer Primary viewing condition is 1, secondary viewing condition is 2
isClear true String Whether to clear the whitelist in one click
Y: Clear the whitelist
N: Delete the whitelist based on the request parameter code
code false String Membership code (required when isClear is N)
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is invoked). 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 invoked). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings)

Return Object Description

true indicates successful deletion, false indicates failure.





11. Query Channel or Global Registered Viewing Fields

Description

查询频道或全局登记观看字段
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/get-record-field

Call Constraints

  1. The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testGetChannelAuthField() throws Exception, NoSuchAlgorithmException {
        LiveChannelAuthFieldRequest liveChannelAuthFieldRequest = new LiveChannelAuthFieldRequest();
        LiveChannelAuthFieldResponse liveChannelAuthFieldResponse;
        try {
            liveChannelAuthFieldRequest.setChannelId(createChannel())
                    .setRank(1);
            liveChannelAuthFieldResponse = new LiveWebAuthServiceImpl().getChannelAuthField(
                    liveChannelAuthFieldRequest);
            Assert.assertNotNull(liveChannelAuthFieldResponse);
            if (liveChannelAuthFieldResponse != null) {
                //to do something ......
                log.debug("测试查询频道或全局登记观看字段成功,{}", JSON.toJSONString(liveChannelAuthFieldResponse));
            }
        } 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 Testing Instructions

  1. If the request is correct, a LiveChannelAuthFieldResponse object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. See PloyvSdkException.getMessage() for error details, e.g., [ Validation failed for input parameter [xxx.chat.LivexxxRequest] object, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
rank true Integer Primary viewing condition is 1, secondary viewing condition is 2
channelId false String Channel ID; leave blank to retrieve global settings
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up 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 to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings)

Return Object Description

Parameter Name Type Description
channelAuthFields Array Registration viewing fields [See ChannelAuthField Parameter Description]
ChannelAuthField Parameter Description
Parameter Type Description
type String Registration viewing type. name - name; mobile - phone number; number - numeric; option - dropdown selection; text - text
name String Registration viewing information title
placeholder String Registration viewing information description
options String Options when registration viewing is a dropdown selection, separated by commas






12. Query Page Registration Watch List

Description

查询页面登记观看列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/get-record-info

Call Constraints

  1. The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testGetChannelAuthInfo() throws Exception, NoSuchAlgorithmException {
        LiveChannelAuthInfoRequest liveChannelAuthInfoRequest = new LiveChannelAuthInfoRequest();
        LiveChannelAuthInfoResponse liveChannelAuthInfoResponse;
        try {
            liveChannelAuthInfoRequest.setChannelId(createChannel());
            liveChannelAuthInfoResponse = new LiveWebAuthServiceImpl().getChannelAuthInfo(liveChannelAuthInfoRequest);
            Assert.assertNotNull(liveChannelAuthInfoResponse);
            if (liveChannelAuthInfoResponse != null) {
                //to do something ......
                log.debug("测试查询页面登记观看列表成功,{}", JSON.toJSONString(liveChannelAuthInfoResponse));
            }
        } 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 Testing Instructions

  1. If the request is correct, a LiveChannelAuthInfoResponse object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
currentPage false Integer Page number, defaults to 1 [corresponds to the page field in the API documentation]
pageSize false Integer Number of data items displayed per page, defaults to 20
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtain it by registering on the POLYV official website. Path: 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 to set up multi-account calls). Obtain it by registering on the POLYV official website. Path: Official website -> Login -> Live Streaming (Development Settings)

Return Object Description

Parameter Name Type Description
contents Array Page registration records [See ChannelAuthInfo Parameter Description]
pageSize Integer Number of data items displayed per page, default is 20 items per page
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]
ChannelAuthInfo Parameter Description
Parameter Name Type Description
createdTime Date Registration time
params Array Registered content data






13. Register Viewing Record for Download Channel

Description

接口用于下载频道的登记观看列表,包含登记观看记录字段和数据内容
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/download-record-info

Call Constraints

  1. The API call has a frequency limit. For details, see here. For common call exceptions, see here.

Unit Testing

    @Test
    public void testDownloadChannelAuthInfo() throws Exception, NoSuchAlgorithmException {
        LiveDownloadChannelAuthInfoRequest liveDownloadChannelAuthInfoRequest =
                new LiveDownloadChannelAuthInfoRequest();
        byte[] liveDownloadChannelAuthInfoResponse;
        try {
            //path设置为下载文件路径
            String path = Paths.get(getClass().getResource("/file/").toURI()).toString() + "downLoad.xlsx";
            liveDownloadChannelAuthInfoRequest.setChannelId(createChannel())
                    .setRank(1);
            liveDownloadChannelAuthInfoResponse = new LiveWebAuthServiceImpl().downloadChannelAuthInfo(
                    liveDownloadChannelAuthInfoRequest);
            Assert.assertNotNull(liveDownloadChannelAuthInfoResponse);
            if (liveDownloadChannelAuthInfoResponse != null) {
                FileUtil.writeFile(liveDownloadChannelAuthInfoResponse, path);
                //to do something ......
                log.debug("测试下载频道登记观看记录成功, 文件长度 {}", liveDownloadChannelAuthInfoResponse.length);
            }
        } 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 Testing Instructions

  1. If the request is correct, a byte[] object is returned, and Party B processes the business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId true String Channel ID
rank true Integer 1 for primary condition, 2 for secondary condition. Affects the exported table header
appId false String POLYV user APP_ID. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website, path: Official website -> Login -> Live Streaming (Development Settings)
appSecret false String POLYV user APP_SECRET. This parameter is required for multi-account calls (i.e., when initMultiAccount() is called to set up multi-account calls). Obtained by registering on the Polyv official website, path: Official website -> Login -> Live Streaming (Development Settings)

Return Object Description

The returned byte[] can be saved according to the unit test example, or processed as needed.





14. Add Whitelist

Description

用于设置频道或全局观看条件中的白名单列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/upload-white-list

Call Constraints

  1. The API call has a frequency limit. Click here for details. For common call exceptions, click here for details.

Unit Testing

    @Test
    public void testUploadWhiteList() throws Exception, NoSuchAlgorithmException {
        LiveUploadWhiteListRequest liveUploadWhiteListRequest = new LiveUploadWhiteListRequest();
        Boolean liveUploadWhiteListResponse;
        try {
            //path设置为模板文件路径(已填写完数据)
            String path = getClass().getResource("/file/WhiteListTemplate.xls").getPath();
            liveUploadWhiteListRequest.setChannelId(createChannel())
                    .setRank(1)
                    .setFile(new File(path));
            liveUploadWhiteListResponse = new LiveWebAuthServiceImpl().uploadWhiteList(liveUploadWhiteListRequest);
            Assert.assertTrue(liveUploadWhiteListResponse);
            if (liveUploadWhiteListResponse) {
                //to do something ......
                log.debug("测试新增白名单成功");
            }
        } 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 Testing Instructions

  1. If the request is correct, a Boolean object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed fields [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId false String Channel ID; if absent, it is a global setting
rank true Integer Primary viewing condition is 1, secondary viewing condition is 2
file true File Whitelist file (Whitelist Template)
appId false String POLYV user APP_ID; required for multi-account calls (i.e., when initMultiAccount() is invoked to set up multi-account calls). 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 invoked to set up multi-account calls). Obtain it by registering on the Polyv official website: Official website -> Login -> Live Streaming (Development Settings)

Return Object Description

If the imported data has the same member code as an existing list entry, the imported nickname will overwrite the current nickname.




15. Download Channel Watchlist Whitelist

Description

用于下载全局或频道的观看条件白名单列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/auth/download-white-list

Call Constraints

  1. The API call has a frequency limit. For details, please refer to [/live/java/limit.md]. For common call exceptions, please refer to [/live/java/exceptionDoc].

Unit Testing

    @Test
    public void testDownloadChannelWhiteList() throws Exception, NoSuchAlgorithmException {
       LiveDownloadChannelWhiteListRequest liveDownloadChannelWhiteListRequest = new LiveDownloadChannelWhiteListRequest();
        byte[] liveDownloadChannelWhiteListResponse;
        try {
            //path设置为下载文件路径
            String path = Paths.get(getClass().getResource("/file/").toURI()).toString() + "downLoadWhiteList.xlsx";
            liveDownloadChannelWhiteListRequest.setChannelId(createChannel())
                    .setRank(1);
            liveDownloadChannelWhiteListResponse = new LiveWebAuthServiceImpl().downloadChannelWhiteList(
                    liveDownloadChannelWhiteListRequest);
            Assert.assertNotNull(liveDownloadChannelWhiteListResponse);
            if (liveDownloadChannelWhiteListResponse != null) {
                FileUtil.writeFile(liveDownloadChannelWhiteListResponse, path);
                //to do something ......
                log.debug("测试下载频道观看白名单列表成功, 文件长度 {}", liveDownloadChannelWhiteListResponse.length);
            }
        } 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 Testing Instructions

  1. If the request is correct, a byte[] object is returned, and Party B processes the business logic based on this object.

  2. If request parameter validation fails, a PloyvSdkException is thrown. The error message can be found via PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty] ]

  3. The server encountered an exception and threw a PloyvSdkException. For error details, see PloyvSdkException.getMessage(), e.g., [ Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature. ]

Request Parameter Description

Parameter Required Type Description
channelId false String Channel ID, the channel to download; if not provided, the global setting applies.
rank true Integer 1 for primary condition, 2 for secondary condition.
appId false String POLYV user APP_ID, required for multi-account calls (i.e., when initMultiAccount() is called to set up 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 to set up multi-account invocation). Obtain it by registering on the Polyv official website: Official Website -> Login -> Live Streaming (Development Settings).

Return Object Description

The returned byte[] can be saved according to the unit test example, or processed as needed.

联系客服,在线咨询