Polyv Help Center

Help Center

encryptionSettingsService

Updated: 2023-09-22 17:47:34

1. Query Account Encryption Settings

Description

查询账号加密设置的相关参数
接口地址(仅做说明使用):https://api.polyv.net/v2/setting/%s/get-playsafe

Call Constraints

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

Unit Test

    @Test
    public void testGetEncryptionSettings() throws IOException, NoSuchAlgorithmException {
        VodGetEncryptionSettingsRequest vodGetEncryptionSettingsRequest = new VodGetEncryptionSettingsRequest();
        VodGetEncryptionSettingsResponse vodGetEncryptionSettingsResponse = null;
        try {
            vodGetEncryptionSettingsResponse = new VodEncryptionSettingsServiceImpl().getEncryptionSettings(
                    vodGetEncryptionSettingsRequest);
            Assert.assertNotNull(vodGetEncryptionSettingsResponse);
            if (vodGetEncryptionSettingsResponse != null) {
                log.debug("测试查询账号加密设置成功,{}", JSON.toJSONString(vodGetEncryptionSettingsResponse));
            }
        } 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

  1. If the request is correct, a VodGetEncryptionSettingsResponse 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 in PloyvSdkException.getMessage(), e.g., [Validation failed for input parameter [xxx.chat.VodxxxRequest] object, failed field [pic cannot be empty / msg cannot be empty]].

  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

This method uses system-wide configuration and does not require explicit parameter passing.

Response Object Description

Parameter Type Description
encrypt Integer Whether encryption is enabled: 1 for enabled, 0 for disabled
hlsLevel String Encryption authorization parameter. Values: open/web/app/wxa_app. open = open authorization, web = WEB authorization, app = APP authorization, wxa_app = mini-program authorization [Corresponds to the hlslevel field in the API documentation]






2. Modify Account Encryption Settings

Description

通过加密授权相关的参数修改账号加密设置
接口地址(仅做说明使用):https://api.polyv.net/v2/setting/%s/set-playsafe

Call Constraints

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

Unit Test

    @Test
    public void testUpdateEncryptionSettings() throws IOException, NoSuchAlgorithmException {
        VodUpdateEncryptionSettingsRequest vodUpdateEncryptionSettingsRequest =
                new VodUpdateEncryptionSettingsRequest();
        VodUpdateEncryptionSettingsResponse vodUpdateEncryptionSettingsResponse = null;
        try {
            vodUpdateEncryptionSettingsRequest.setEncrypt(1)
                    .setHlsLevel("open");
            vodUpdateEncryptionSettingsResponse = new VodEncryptionSettingsServiceImpl().updateEncryptionSettings(
                    vodUpdateEncryptionSettingsRequest);
            Assert.assertNotNull(vodUpdateEncryptionSettingsResponse);
            if (vodUpdateEncryptionSettingsResponse != null) {
                log.debug("测试修改账号加密设置成功,{}", JSON.toJSONString(vodUpdateEncryptionSettingsResponse));
            }
        } 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

  1. If the request is correct, a VodUpdateEncryptionSettingsResponse 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 in PloyvSdkException.getMessage(), e.g., [Validation failed for input parameter [xxx.chat.VodxxxRequest] object, failed field [pic cannot be empty / msg cannot be empty]].

  3. If the server encounters an error, a PloyvSdkException is thrown. The error message can be found in PloyvSdkException.getMessage(), e.g., [Polyv request returned data error, request serial number: 66e7ad29fd04425a84c2b2b562d2025b, error reason: invalid signature.]

Request Parameter Description

Parameter Required Type Description
encrypt true Integer Whether encryption is enabled: 1 for enabled, 0 for disabled
hlsLevel true String Encryption authorization parameter. Values: open/web/app/wxa_app. open = open authorization, web = WEB authorization, app = APP authorization, wxa_app = mini-program authorization [Corresponds to the hlslevel field in the API documentation]

Response Object Description

Parameter Type Description
encrypt Integer Whether encryption is enabled: 1 for enabled, 0 for disabled
hlsLevel String Encryption authorization parameter. Values: open/web/app/wxa_app. open = open authorization, web = WEB authorization, app = APP authorization, wxa_app = mini-program authorization [Corresponds to the hlslevel field in the API documentation]

联系客服,在线咨询