Polyv Help Center

Help Center

subAccountService

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

1. Search Videos

Description

通过视频标题、分类、标签等条件查找视频
接口地址(仅做说明使用):https://api.polyv.net//v3/video/list-video

Call Constraints

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

Unit Testing

    @Test
    public void testSearchVideoList() throws IOException, NoSuchAlgorithmException {
        VodSubAccountSearchVideoListRequest vodSubAccountSearchVideoListRequest =
                new VodSubAccountSearchVideoListRequest();
        VodSubAccountSearchVideoListResponse vodSubAccountSearchVideoListResponse = null;
        try {
            vodSubAccountSearchVideoListRequest.setCategoryId("1602300731843")
                    .setTitle("学习英语")
                    .setUploader("主账号")
                    .setStatus("61")
                    .setContainSubCate("Y")
                    .setStartTime(super.getDate(2021, 1, 4, 10, 35))
                    .setEndTime(super.getDate(2021, 2, 5, 10, 35))
                    .setSort("creationTimeDesc")
                    //设置子账号相关
                    .setAppId(APP_ID)
                    .setSecretKey(SECRET_KEY);
            vodSubAccountSearchVideoListResponse = new VodSubAccountServiceImpl().searchVideoList(
                    vodSubAccountSearchVideoListRequest);
            Assert.assertNotNull(vodSubAccountSearchVideoListResponse);
            if (vodSubAccountSearchVideoListResponse != null) {
                log.debug("测试搜索视频成功,{}", JSON.toJSONString(vodSubAccountSearchVideoListResponse));
            }
        } 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, return a VodSubAccountSearchVideoListResponse object, 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 in PloyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] 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
categoryId false String Video category ID [corresponds to the cataId field in the API documentation]
title false String Search by title
uploader false String Uploader
status false String Video status code; 60/61: Published; 10: Waiting for encoding; 20: Encoding; 50: Waiting for review; 51: Review failed; -1: Deleted
containSubCate false String Whether to include subcategories, Y includes, N does not include
startTime false Date Query by creation time range, start time, format: yyyy-MM-dd HH:mm:ss
endTime false Date End time, format: yyyy-MM-dd HH:mm:ss
sort false String Sort by creationTimeDesc or creationTimeAsc
appId true String Sub-account appId
secretKey true String Sub-account secretKey
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 items per page

Return Object Description

Parameter Type Description
contents Array List of query results See VodSearchVideoList 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]
VodSearchVideoList Parameter Description
Parameter Type Description
videoId String Video ID [corresponds to the vid field in the API documentation]
basicInfo BasicInfo Basic information of the queried video [see BasicInfo parameter description for details]
BasicInfo Parameter Description
Parameter Name Type Description
title String Video title
description String Video description
duration Integer Source video duration, in seconds
coverURL String Cover image URL, large image
creationTime Date Creation time
updateTime Date Update time
size Long Source file size, in Bytes
status Integer Video status code; 60/61: Published; 10: Waiting for encoding; 20: Encoding; 50: Pending review; 51: Review failed; -1: Deleted
categoryId String Category ID, e.g., 1 for root directory [corresponds to the cateId field in the API documentation]
categoryName String Category name [corresponds to the cateName field in the API documentation]
tags String Tags
uploader String Uploader






2. Query Video Information

Description

通过视频id查询视频信息
接口地址(仅做说明使用):https://api.polyv.net//v3/video/get-video-info

Call Constraints

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

Unit Testing

    @Test
    public void testGetVideoInfo() throws IOException, NoSuchAlgorithmException {
        VodSubAccountQueryVideoInfoRequest vodSubAccountQueryVideoInfoRequest =
                new VodSubAccountQueryVideoInfoRequest();
        List<VodSubAccountQueryVideoInfoResponse> vodSubAccountQueryVideoInfoResponseList = null;
        try {
            vodSubAccountQueryVideoInfoRequest.setVideoIds(super.getTestVideoId())
                    .setFilters("basicInfo,metaData,transcodeInfo,snapshotInfo")
                    //设置子账号相关
                    .setAppId(APP_ID)
                    .setSecretKey(SECRET_KEY);
            vodSubAccountQueryVideoInfoResponseList = new VodSubAccountServiceImpl().getVideoInfo(
                    vodSubAccountQueryVideoInfoRequest);
            Assert.assertNotNull(vodSubAccountQueryVideoInfoResponseList);
            if (vodSubAccountQueryVideoInfoResponseList != null) {
                log.debug("测试查询视频信息,{}", JSON.toJSONString(vodSubAccountQueryVideoInfoResponseList));
            }
        } 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, return a VodSubAccountQueryVideoInfoResponse object, 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.VodxxxRequest] 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
videoIds true String Video IDs, multiple video IDs separated by commas (half-width), e.g., 1b8be3,239c2e [Corresponds to the vids field in the API documentation]
filters false String Select the video information to return, multiple separated by commas (half-width, e.g., basicInfo,metaData). Values: basicInfo, metaData, transcodeInfo, snapshotInfo, representing basic info, metadata, transcoding info, and snapshot info respectively. If empty, basic info is returned [Corresponds to the filter field in the API documentation]
appId true String Sub-account appId
secretKey true String Sub-account secretKey

Return Object Description

The return object is List<VodSubAccountQueryVideoInfoResponse>. The specific elements of VodSubAccountQueryVideoInfoResponse are as follows:

Parameter Type Description
videoId String Video ID [corresponds to the vid field in the API documentation]
basicInfo BasicInfo Basic information of the queried video [see BasicInfo parameter description]
transcodeInfos Array Transcoding information of the queried video [see TranscodeInfos parameter description]
metaData MetaData Metadata of the queried video [see MetaData parameter description]
snapshotInfo SnapshotInfo Snapshots of the queried video [see SnapshotInfo parameter description]
BasicInfo Parameter Description
Parameter Name Type Description
title String Video title
description String Video description
duration Integer Source video duration, in seconds
coverURL String Cover image URL, large image
creationTime Date Creation time
updateTime Date Update time
size Long Source file size, in Bytes
status Integer Video status code; 60/61: Published; 10: Waiting for encoding; 20: Encoding; 50: Pending review; 51: Review failed; -1: Deleted
categoryId String Category ID, e.g., 1 for root directory [corresponds to the cateId field in the API documentation]
categoryName String Category name [corresponds to the cateName field in the API documentation]
tags String Tags
uploader String Uploader
TranscodeInfos Parameter Description
Parameter Type Description
playUrl String Playback URL
definition String Quality: SOURCE (original), LD (low definition), SD (standard definition), HD (high definition)
duration Integer Duration in seconds
encrypt Boolean True for encrypted video, false for non-encrypted
format String Transcoding format, e.g., mp4, flv, pdx, hls
fps Integer Video frame rate
bitrate Integer Bitrate in kbps
height Integer Resolution height in px
width Integer Resolution width in px
status String Video status: normal (playable), unavailable (cannot play normally)
fileSize Long Encoded video size in bytes
MetaData Parameter Description
Parameter Type Description
size Long Source file size, in Bytes
format String Video container type, e.g., mp4, flv
duration Integer Source video duration, in seconds
bitrate Integer Video bitrate, in bps
fps Integer Video frame rate
height Integer Resolution height, in px
width Integer Resolution width, in px
codec String Encoding format, e.g., h264, h265
SnapshotInfo Parameter Description
Parameter Type Description
imageUrl Array Array of screenshot URLs






3. Modify Video Information

Description

通过视频id修改视频信息
接口地址(仅做说明使用):https://api.polyv.net//v3/video/update-info

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 testUpdateVideoInfo() throws IOException, NoSuchAlgorithmException {
        VodSubAccountUpdateVideoInfoRequest vodSubAccountUpdateVideoInfoRequest =
                new VodSubAccountUpdateVideoInfoRequest();
        Boolean vodUpdateVideoInfoResponse = null;
        try {
            vodSubAccountUpdateVideoInfoRequest.setVideoId(super.getTestVideoId())
                    .setDesc("这是一个通过junit合并的视频_1")
                    .setTag("junit测试_1")
                    .setPublishUrl(null)
                    //设置子账号相关
                    .setAppId(APP_ID)
                    .setSecretKey(SECRET_KEY);
            vodUpdateVideoInfoResponse = new VodSubAccountServiceImpl().updateVideoInfo(
                    vodSubAccountUpdateVideoInfoRequest);
            Assert.assertTrue(vodUpdateVideoInfoResponse);
            if (vodUpdateVideoInfoResponse) {
                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. For error details, refer to PloyvSdkException.getMessage(), e.g., [ Input parameter [xxx.chat.VodxxxRequest] 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
videoId true String Video ID [corresponds to the vid field in the API documentation]
title false String Video title
desc false String Video description [corresponds to the describ field in the API documentation]
tag false String Video tag information
publishUrl false String External link URL
appId true String Sub-account appId
secretKey true String Sub-account secretKey

Return Object Description

true indicates modification succeeded, false indicates modification failed.





4. Delete Video

Description

通过视频id删除视频
接口地址(仅做说明使用):https://api.polyv.net//v3/video/delete-video

Call Constraints

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

Unit Testing

    @Test
    public void testDeleteVideo() throws IOException, NoSuchAlgorithmException {
        VodSubAccountDeleteVideoRequest vodSubAccountDeleteVideoRequest = new VodSubAccountDeleteVideoRequest();
        Boolean vodDeleteVideoResponse = null;
        try {
            vodSubAccountDeleteVideoRequest.setVideoId("1b448be3238415eee2fa40753737255b_1")
                    //设置子账号相关
                    .setAppId(APP_ID).setSecretKey(SECRET_KEY);
            vodDeleteVideoResponse = new VodSubAccountServiceImpl().deleteVideo(vodSubAccountDeleteVideoRequest);
            Assert.assertTrue(vodDeleteVideoResponse);
            if (vodDeleteVideoResponse) {
                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.VodxxxRequest] 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
videoId true String Video ID [corresponds to the vid field in the API documentation]
appId true String Sub-account appId
secretKey true String Sub-account secretKey

Return Object Description

true indicates the video was deleted successfully, false indicates the video deletion failed.





5. Add Video Category

Description

通过分类名等参数新增视频分类
接口地址(仅做说明使用):https://api.polyv.net//v3/category/add

Call Constraints

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

Unit Testing

    @Test
    public void testAddCategory() throws IOException, NoSuchAlgorithmException {
        VodSubAccountAddCategoryRequest vodSubAccountAddCategoryRequest = new VodSubAccountAddCategoryRequest();
        String vodDeleteVideoResponse = null;
        try {
            vodSubAccountAddCategoryRequest.setName("junit测试新增分类20210309").setParentId(null)
                    //设置子账号相关
                    .setAppId(APP_ID).setSecretKey(SECRET_KEY);
            vodDeleteVideoResponse = new VodSubAccountServiceImpl().addCategory(vodSubAccountAddCategoryRequest);
            Assert.assertNotNull(vodDeleteVideoResponse);
            if (vodDeleteVideoResponse != null) {
                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 String 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.VodxxxRequest] 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
name true String Category name
parentId false String Parent category ID, defaults to 1, placed under the root directory
appId true String Sub-account appId
secretKey true String Sub-account secretKey

Return Object Description

On successful addition, return the ID of the newly added category




6. Query Video Categories

Description

通过分类id查询视频分类
接口地址(仅做说明使用):https://api.polyv.net//v3/category/get

Call Constraints

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

Unit Testing

    @Test
    public void testQueryCategory() throws IOException, NoSuchAlgorithmException {
        VodSubAccountQueryCategoryRequest vodSubAccountQueryCategoryRequest = new VodSubAccountQueryCategoryRequest();
        VodSubAccountQueryCategoryResponse vodSubAccountQueryCategoryResponse = null;
        try {
            vodSubAccountQueryCategoryRequest.setCategoryId("1608891483165")
                    //设置子账号相关
                    .setAppId(APP_ID).setSecretKey(SECRET_KEY).setCurrentPage(1).setPageSize(20);
            vodSubAccountQueryCategoryResponse = new VodSubAccountServiceImpl().queryCategory(
                    vodSubAccountQueryCategoryRequest);
            Assert.assertNotNull(vodSubAccountQueryCategoryResponse);
            if (vodSubAccountQueryCategoryResponse != null) {
                log.debug("测试查询视频分类成功,{}", JSON.toJSONString(vodSubAccountQueryCategoryResponse));
            }
        } 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, return a VodSubAccountQueryCategoryResponse object, 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.VodxxxRequest] 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 Name Required Type Description
categoryId true String Category ID [corresponds to the cateId field in the API documentation]
appId true String Sub-account appId
secretKey true String Sub-account secretKey
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 items per page

Return Object Description

Parameter Type Description
category Category Current category [See Category parameter description for details]
subCategoryTotal Integer Number of next-level subcategories
subCategories Array List of next-level subcategories [See Category parameter description for details]
Category parameter description
Parameter Name Type Description
categoryId String Category ID [corresponds to the cateId field in the API documentation]
categoryName String Category name [corresponds to the cateName field in the API documentation]
parentId String Parent category ID






7. Modify Video Category

Description

修改视频分类
接口地址(仅做说明使用):https://api.polyv.net//v3/category/update-info

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 testUpdateCategory() throws IOException, NoSuchAlgorithmException {
        VodSubAccountUpdateCategoryRequest vodSubAccountUpdateCategoryRequest =
                new VodSubAccountUpdateCategoryRequest();
        Boolean vodUpdateCategoryResponse = null;
        try {
            vodSubAccountUpdateCategoryRequest.setCategoryId("1602671097888").setCategoryName("勿删分类-"+super.getRandomString(4))
                    //设置子账号相关
                    .setAppId(APP_ID).setSecretKey(SECRET_KEY);
            vodUpdateCategoryResponse = new VodSubAccountServiceImpl().updateCategory(
                    vodSubAccountUpdateCategoryRequest);
            Assert.assertTrue(vodUpdateCategoryResponse);
            if (vodUpdateCategoryResponse) {
                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. 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.VodxxxRequest] 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
categoryId true String Category ID [corresponds to the cateId field in the API documentation]
categoryName true String Category name [corresponds to the cateName field in the API documentation]
appId true String Sub-account appId
secretKey true String Sub-account secretKey

Return Object Description

true indicates modification succeeded, false indicates modification failed




8. Delete Video Category

Description

通过视频分类id删除视频分类
接口地址(仅做说明使用):https://api.polyv.net//v3/category/delete

Call Constraints

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

Unit Testing

    @Test
    public void testDeleteCategory() throws IOException, NoSuchAlgorithmException {
        VodSubAccountDeleteCategoryRequest vodSubAccountDeleteCategoryRequest =
                new VodSubAccountDeleteCategoryRequest();
        Boolean vodDeleteCategoryResponse = null;
        try {
            //生成测试数据
            String categoryId = super.addCategoryOther();
            vodSubAccountDeleteCategoryRequest.setCategoryId(categoryId)
                    //设置子账号相关
                    .setAppId(APP_ID).setSecretKey(SECRET_KEY);
            vodDeleteCategoryResponse = new VodSubAccountServiceImpl().deleteCategory(
                    vodSubAccountDeleteCategoryRequest);
            Assert.assertTrue(vodDeleteCategoryResponse);
            if (vodDeleteCategoryResponse) {
                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. 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.VodxxxRequest] 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
categoryId true String Category ID [corresponds to the cateId field in the API documentation]
appId true String Sub-account appId
secretKey true String Sub-account secretKey

Return Object Description

true indicates successful deletion, false indicates failed deletion




9. Batch Modify Video Categories

Description

通过视频id批量修改视频所属分类
接口地址(仅做说明使用):https://api.polyv.net//v3/video/update-category

Call Constraints

  1. API calls are subject to frequency limits. For details, see here. For common call exceptions, see here.

Unit Testing

    @Test
    public void testUpdateVideoCategory() throws IOException, NoSuchAlgorithmException {
        VodSubAccountUpdateVideoCategoryRequest vodSubAccountUpdateVideoCategoryRequest =
                new VodSubAccountUpdateVideoCategoryRequest();
        Boolean vodUpdateVideoCategoryResponse = null;
        try {
            vodSubAccountUpdateVideoCategoryRequest.setVideoIds(super.getTestVideoId()).setCategoryId("1602300731843")
                    //设置子账号相关
                    .setAppId(APP_ID)
                    .setSecretKey(SECRET_KEY);
            vodUpdateVideoCategoryResponse = new VodSubAccountServiceImpl().updateVideoCategory(
                    vodSubAccountUpdateVideoCategoryRequest);
            Assert.assertTrue(vodUpdateVideoCategoryResponse);
            if (vodUpdateVideoCategoryResponse) {
                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.VodxxxRequest] 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
videoIds true String Video ID string, multiple video IDs separated by English commas (half-width state), e.g., 1b8be3,239c2e [Corresponds to the vids field in the API documentation]
categoryId false String Video category ID [Corresponds to the cateId field in the API documentation]
appId true String Sub-account appId
secretKey true String Sub-account secretKey

Return Object Description

true indicates modification succeeded, false indicates modification failed.





10. Modify Video Category Attribute Settings

Description

通过分类id修改视频分类属性设置
接口地址(仅做说明使用):https://api.polyv.net//v3/category/update-profile

Call Constraints

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

Unit Testing

    @Test
    public void testUpdateCategoryProfile() throws IOException, NoSuchAlgorithmException {
        VodSubAccountUpdateCategoryProfileRequest vodSubAccountUpdateCategoryProfileRequest =
                new VodSubAccountUpdateCategoryProfileRequest();
        Boolean vodUpdateCategoryProfileResponse = null;
        try {
            vodSubAccountUpdateCategoryProfileRequest.setCategoryId("1615286323771")
                    .setEnabled("Y")
                    .setKeepSource(0)
                    .setEncrypt(0)
                    .setEncryptLevel("open")
                    .setIsEdu(0)
                    .setEncodeAAC(0)
                    //设置子账号相关
                    .setAppId(APP_ID)
                    .setSecretKey(SECRET_KEY);
            vodUpdateCategoryProfileResponse = new VodSubAccountServiceImpl().updateCategoryProfile(
                    vodSubAccountUpdateCategoryProfileRequest);
            Assert.assertTrue(vodUpdateCategoryProfileResponse);
            if (vodUpdateCategoryProfileResponse) {
                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.VodxxxRequest] 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 Name Required Type Description
categoryId true String Category ID [corresponds to the cateId field in the API documentation]
enabled false String Whether to enable category settings: Y: enable, N: disable, default value is N: disable
keepSource false Integer 1: play source file; 0: play non-source file. If playing source file, the encrypt, encryptLevel, isEdu, and encodeAAC parameters are invalid. Default value is 0: play non-source file
encrypt false Integer 1: enable video encryption, 0: no encryption, default value is 0: no encryption
encryptLevel false String Encryption level, possible values: open, web, app, wxa_app, representing non-encrypted authorization, Web authorization, APP authorization, and Mini Program authorization respectively. Default value is open: non-encrypted authorization
isEdu false Integer 1: enable screen recording optimization, 0: disable, default value is 0: disable
encodeAAC false Integer 1: generate aac, 0: do not generate, default value is 0: do not generate
appId true String Sub-account appId
secretKey true String Sub-account secretKey

Return Object Description

true indicates modification succeeded, false indicates modification failed




11. Get Playsafe Token

Description

通过子账号appId与视频id获取播放凭证,用于播放加密视频
接口地址(仅做说明使用):https://hls.videocc.net//service/v2/token/create-child

Call Constraints

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

  2. If a token (play credential) has not yet expired, and the same videoId, viewerId, viewerIp, and isWxa parameter values are used to request this interface, the original token will be reused and its validity period will be extended.

Unit Test

    @Test
    public void testGetPlaySafeToken() throws IOException, NoSuchAlgorithmException {
        VodSubAccountGetPlaySafeTokenRequest vodSubAccountGetPlaySafeTokenRequest =
                new VodSubAccountGetPlaySafeTokenRequest();
        VodSubAccountGetPlaySafeTokenResponse vodSubAccountGetPlaySafeTokenResponse = null;
        try {
            vodSubAccountGetPlaySafeTokenRequest.setVideoId("1b448be32370f4822ac40fd926112a66_1")
                    .setViewerId("ovtl9t_RxnrTdqkXqkT5Q5lnxp2A")
                    .setViewerIp(super.getRandomIp())
                    .setViewerName("TestViewerName")
                    .setExpires(Long.parseLong("60"))
                    .setDisposable(Boolean.TRUE)
                    .setIsWxa(0)
                    //设置子账号相关
                    .setAppId(APP_ID)
                    .setSecretKey(SECRET_KEY);
            vodSubAccountGetPlaySafeTokenResponse = new VodSubAccountServiceImpl().getPlaySafeToken(
                    vodSubAccountGetPlaySafeTokenRequest);
            Assert.assertNotNull(vodSubAccountGetPlaySafeTokenResponse);
            if (vodSubAccountGetPlaySafeTokenResponse != null) {
                log.debug("测试获取Playsafe Token成功,{}", JSON.toJSONString(vodSubAccountGetPlaySafeTokenResponse));
            }
        } 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 VodSubAccountGetPlaySafeTokenResponse 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.VodxxxRequest] 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
videoId true String Video ID, e.g., e6b23c6f519c5906e54a13b8200d7bb0_e
viewerId true String Viewer ID; different viewers must use different IDs
viewerIp false String Viewer IP; if empty, the IP from the API call will be automatically retrieved
viewerName false String Viewer name
expires false Long Token validity duration in seconds; defaults to 10 minutes if empty
disposable false Boolean Token validity; true means the token is valid only once (invalid after one verification), false means multiple verifications within the validity period. Default is false
isWxa false Integer Whether it is a WeChat Mini Program playback; 1 for yes, 0 for no. Default is 0 [corresponds to the iswxa field in the API documentation]
extraParams false String Custom additional parameters
appId true String Sub-account appId
secretKey true String Sub-account secretKey

Return Object Description

Parameter Type Description
token String Playback credential (token)
userId String User ID
videoId String Video ID, e.g., e6b23c6f519c5906e54a13b8200d7bb0_e
viewerIp String Viewer IP; if empty, the IP from which the API is called will be automatically obtained
viewerId String Viewer ID; different viewers must use different IDs
viewerName String Viewer name
extraParams String Custom additional parameters
ttl Long Token validity duration, in milliseconds
createdTime Date Token creation time
expiredTime Date Token expiration time
isWxa Integer Whether it is a WeChat Mini Program playback; 1 for yes, 0 for no (corresponds to the iswxa field in the API documentation)
disposable Boolean Token validity; true means the token is valid only once (it becomes invalid after one verification), false means multiple verifications are allowed within the validity period






12. Query Sub-account Statistical Summary Data

Description

按日期查询子账号统计汇总数据
接口地址(仅做说明使用):https://api.polyv.net/v2/sub-account/stats/agg/page

Call Constraints

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

Unit Testing

    @Test
    public void testGetSubStatsAgg() throws IOException, NoSuchAlgorithmException {
        VodSubAccountStatsAggPageRequest vodSubAccountStatsAggPageRequest = new VodSubAccountStatsAggPageRequest();
        VodSubAccountStatsAggPageResponse vodSubAccountStatsAggPageResponse = null;
        try {
            vodSubAccountStatsAggPageRequest.setStartDate(getDate(2020, 6, 24)).setEndDate(getDate(2021, 4, 24));
            vodSubAccountStatsAggPageResponse = new VodSubAccountServiceImpl().getSubStatsAgg(
                    vodSubAccountStatsAggPageRequest);
            Assert.assertNotNull(vodSubAccountStatsAggPageResponse);
            if (vodSubAccountStatsAggPageResponse != null) {
                log.debug("测试查询子账号统计汇总数据成功{}", JSON.toJSONString(vodSubAccountStatsAggPageResponse));
            }
        } 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, it returns a VodSubAccountStatsAggPageResponse object, 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.VodxxxRequest] 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
startDate true Date The start date of the query, format: yyyy-MM-dd, the time span must not exceed one year
endDate true Date The end date of the query, format: yyyy-MM-dd, the time span must not exceed one year
email false String The email of the sub-account to query. If both email and appId are provided, email takes precedence
appId false String The appId of the sub-account to query
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 items per page

Return Object Description

Parameter Type Description
contents Array Query result list See VodContentsList 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]
VodContentsList Parameter Description
Parameter Type Description
email String Sub-account email. If the sub-account is deleted, this field is null.
appId String Sub-account appId
flowSize Long Source file size, in bytes
view Long Number of views
duration Long Playback duration, in seconds






13. Query Sub-account Statistics Details

Description

按日期查询子账号统计详情列表
接口地址(仅做说明使用):https://api.polyv.net/v2/sub-account/stats/detail/list

Call Constraints

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

  2. Email and appId cannot both be empty.

Unit Test

    @Test
    public void testGetSubStatsDetailList() throws IOException, NoSuchAlgorithmException {
        VodSubAccountStatsDetailRequest vodSubAccountStatsDetailRequest = new VodSubAccountStatsDetailRequest();
        VodSubAccountStatsDetailResponse vodSubAccountStatsDetailResponse = null;
        try {
            vodSubAccountStatsDetailRequest.setStartDate(getDate(2021, 4, 10))
                    .setEndDate(getDate(2021, 4, 24))
                    .setAppId(APP_ID);
            vodSubAccountStatsDetailResponse = new VodSubAccountServiceImpl().getSubStatsDetailList(
                    vodSubAccountStatsDetailRequest);
            Assert.assertNotNull(vodSubAccountStatsDetailResponse);
            if (vodSubAccountStatsDetailResponse != null) {
                log.debug("测试测试查询子账号统计详情{}", JSON.toJSONString(vodSubAccountStatsDetailResponse));
            }
        } 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 VodSubAccountStatsDetailResponse object is returned, and the B-side processes business logic based on this object.

  2. If request parameter validation fails, a PolyvSdkException is thrown. The error message can be found via PolyvSdkException.getMessage(), for example: [ Input parameter [xxx.chat.VodxxxRequest] 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
startDate true Date The start time of the query, format: yyyy-MM-dd, the time span must not exceed one year
endDate true Date The end time of the query, format: yyyy-MM-dd, the time span must not exceed one year
email false String The email of the sub-account to query. If both email and appId are provided, email takes precedence
appId false String The appId of the sub-account to query

Return Object Description

Parameter Type Description
details Array Query result list [See VodStatsDetailList parameter description]
VodStatsDetailList Parameter Description
Parameter Name Type Description
currentDay String Date, format: yyyy-MM-dd, e.g., 2021-06-01
pcFlowSize Long PC playback traffic, unit: byte
mobileFlowSize Long Mobile playback traffic, unit: byte
totalFlowSize Long Total traffic, unit: byte
pcView Long PC play count, unit: count
mobileView Long Mobile play count, unit: count
totalView Long Total play count, unit: count
pcDuration Long PC playback duration, unit: second
mobileDuration Long Mobile playback duration, unit: second
totalDuration Long Total playback duration, unit: second

联系客服,在线咨询