Polyv Help Center

Help Center

channelDoc

Updated: 2025-09-11 15:18:09

1. Upload Channel Document

Description

上传频道文档
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/document/upload-doc

Call Constraints

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

  2. The uploaded file must not exceed 200MB. Supported formats are limited to (ppt, pdf, pptx, doc, docx, wps, xls, xlsx).

  3. Only one of file or url needs to be provided. If both url and file are provided, the file field takes precedence.

Unit Test

    @Test
    public void testCreateChannelDoc() throws Exception, NoSuchAlgorithmException {
        LiveCreateChannelDocRequest liveCreateChannelDocRequest = new LiveCreateChannelDocRequest();
        LiveCreateChannelDocResponse liveCreateChannelDocResponse;
        try {
            String path = getClass().getResource("/file/PPT.pptx").getPath();
            liveCreateChannelDocRequest.setChannelId(super.createChannel())
                    .setType("common")
//                    .setFile(new File(path))
                    .setUrl("https://help.polyv.net/third_res/PPT.pptx")
                    .setDocName("唐诗三百首")
                    .setCallbackUrl("http://www.baidu.com/callback");
            liveCreateChannelDocResponse = new LiveChannelDocServiceImpl().createChannelDoc(
                    liveCreateChannelDocRequest);
            Assert.assertNotNull(liveCreateChannelDocResponse);
            if (liveCreateChannelDocResponse != null) {
                //to do something ......
                log.debug("测试上传频道文档成功,{}", liveCreateChannelDocResponse);
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
            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 LiveCreateChannelDocResponse object is returned. The B-side 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(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].

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

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
type false String Conversion type ('common': convert to normal image, 'animate': convert to animated effect). Default is normal if not passed. Only ppt and pptx can be converted to animation; other file types are automatically converted to normal. If animation conversion fails, the type is automatically changed to normal.
file false File Uploaded file must not exceed 200MB. Supported formats are limited to (ppt, pdf, pptx, doc, docx, wps, xls, xlsx).
docName false String Document name (if not provided, the filename obtained from the uploaded ppt file is used as the document name by default. The document name must not exceed 100 characters).
callbackUrl false String Callback address for successful document upload and conversion.
url false String File URL (must be an accessible address). Only one of file or url needs to be provided. If both url and file are provided, the file field takes precedence.
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtained by registering on the Polyv official website: Official Website -> Login -> Live (Development Settings).
appSecret false String POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtained by registering on the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

Parameter Name Type Description
fileId String Returns the file ID on success.
autoId Integer Returns the auto-increment record ID of the file on success.
type String Conversion type (common: convert to normal image, animate: convert to animated effect). Only ppt and pptx can be converted to animation; others are automatically converted to normal. If animation conversion fails, the type is also changed to normal.
status String File conversion status (normal: normal, waitConvert: converting PPT, failConvert: PPT conversion failed).






2. Query Channel Document Conversion Status

Description

查询频道文档转换状态
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/document/status/get

Call Constraints

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

Unit Test

    @Test
    public void testGetChannelDocStatus() throws Exception, NoSuchAlgorithmException {
        LiveChannelDocStatusRequest liveChannelDocStatusRequest = new LiveChannelDocStatusRequest();
        LiveChannelDocStatusResponse liveChannelDocStatusResponse;
        try {
            String channelId = super.createChannel();
            liveChannelDocStatusRequest.setChannelId(channelId)
                    .setFileId("c2d585857870f4eff024976e3a265c0b1965681common," +
                            "6e0603f6c8ec6113b87f69a7191d22021965681common");
            liveChannelDocStatusResponse = new LiveChannelDocServiceImpl().getChannelDocStatus(
                    liveChannelDocStatusRequest);
            Assert.assertNotNull(liveChannelDocStatusResponse);
            if (liveChannelDocStatusResponse != null) {
                //to do something ......
                log.debug("测试查询频道文档转换状态成功,{}", JSON.toJSONString(liveChannelDocStatusResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
            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 LiveChannelDocStatusResponse object is returned. The B-side 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(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].

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

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
fileId true String File ID(s). If there are multiple, they can be concatenated into a string separated by English commas.
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtained by registering on the Polyv official website: Official Website -> Login -> Live (Development Settings).
appSecret false String POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtained by registering on the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

Parameter Name Type Description
channelDocStatuses Array Channel document list conversion information [See ChannelDocStatus Parameter Description for details].
ChannelDocStatus Parameter Description
Parameter Name Type Description
convertStatus String Conversion status. ("normal": normal. "failUpload": upload failed. "waitConvert": converting PPT. "failConvert": conversion failed, the failure reason is returned in the data[0].errorMsg field).
errorMsg String Error message (returned when convertStatus = "failConvert").
totalPage Integer Total number of pages (returned when convertStatus = "normal").
images Array Array of large image URLs (returned when convertStatus = "normal").
smallImages Array Array of small image URLs (returned when convertStatus = "normal").
imageCount Integer Number of large images (returned when convertStatus = "normal").
htmlUrl String Animated PPT URL (returned when convertStatus = "normal").
fileId String File ID.






3. Get Channel Document List

Description

获取频道文档列表
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/document/doc-list

Call Constraints

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

Unit Test

    @Test
    public void testListChannelDoc() throws Exception, NoSuchAlgorithmException {
        LiveListChannelDocRequest liveListChannelDocRequest = new LiveListChannelDocRequest();
        LiveListChannelDocResponse liveListChannelDocResponse;
        try {
            String channelId = super.createChannel();
            liveListChannelDocRequest.setChannelId(channelId).setIsShowUrl("Y").setStatus(null);
            liveListChannelDocResponse = new LiveChannelDocServiceImpl().listChannelDoc(liveListChannelDocRequest);
            Assert.assertNotNull(liveListChannelDocResponse);
            if (liveListChannelDocResponse != null) {
                //to do something ......
                log.debug("测试获取频道文档列表成功,{}", JSON.toJSONString(liveListChannelDocResponse));
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
            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 LiveListChannelDocResponse object is returned. The B-side 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(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].

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

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
status false String Document status. If not passed, query all. ("normal": normal, "waitUpload": waiting to upload, "failUpload": upload failed, "waitConvert": converting PPT, "failConvert": PPT conversion failed).
isShowUrl false String Whether to display the original PPT file URL. Y: Yes; N: No; Default is N.
currentPage false Integer Page number, default is 1 [Corresponds to the page field in the API documentation].
pageSize false Integer Number of data items displayed per page, default is 20 items per page [Corresponds to the limit field in the API documentation].
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtained by registering on the Polyv official website: Official Website -> Login -> Live (Development Settings).
appSecret false String POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtained by registering on the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

Parameter Name Type Description
contents Array Channel documents [See ChannelDoc Parameter Description for details].
pageSize Integer Number of data items displayed per page, default is 20 items per page.
currentPage Integer Current page number [Corresponds to the pageNumber field in the API documentation].
totalItems Integer Total number of records.
totalPage Integer Total number of pages [Corresponds to the totalPages field in the API documentation].
ChannelDoc Parameter Description
Parameter Name Type Description
autoId Integer Document ID.
fileId String File ID.
fileName String File name.
fileUrl String File URL (returned when isShowUrl is 'Y').
fileType String File type, e.g., .pdf.
totalPage Integer Total number of PPT pages.
channelId String Channel ID.
status String PPT conversion status ("normal": normal, "waitUpload": waiting to upload, "failUpload": upload failed, "waitConvert": converting PPT, "failConvert": PPT conversion failed).
createTime Date Creation time.
convertType String Conversion type (common: normal PPT, animate: animated PPT).
type String Type, distinguishes between old and new PPT versions. New version value is "new", old version value is "old".
previewImage String PPT preview small image URL, e.g., http://doc-2.polyv.net/x/xxx_0.jpeg.






4. Delete Channel Document

Description

删除频道文档
接口地址(仅做说明使用):https://api.polyv.net/live/v3/channel/document/delete

Call Constraints

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

Unit Test

    @Test
    public void testDeleteChannelDoc() throws Exception, NoSuchAlgorithmException {
        LiveDeleteChannelDocRequest liveDeleteChannelDocRequest = new LiveDeleteChannelDocRequest();
        Boolean liveDeleteChannelDocResponse;
        try {
            String channelId = super.createChannel();
            liveDeleteChannelDocRequest.setChannelId(channelId)
                    .setFileId("6897d12bd284dd1e9b8b8534b6af91c31965681common")
                    .setType("new");
            liveDeleteChannelDocResponse = new LiveChannelDocServiceImpl().deleteChannelDoc(
                    liveDeleteChannelDocRequest);
            Assert.assertTrue(liveDeleteChannelDocResponse);
            if (liveDeleteChannelDocResponse) {
                //to do something ......
                log.debug("测试删除频道文档成功");
            }
        } catch (PloyvSdkException e) {
            //参数校验不合格 或者 请求服务器端500错误,错误信息见PloyvSdkException.getMessage(),B
            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 Boolean object is returned. The B-side 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(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].

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

Request Parameter Description

Parameter Name Required Type Description
channelId true String Channel ID
fileId true String File ID(s). If there are multiple, they can be concatenated into a string separated by English commas.
type true String Old/new file type. old: old version, new: new version [This value can be obtained from the type field in the data returned by the document list API]. [If multiple files need to be deleted, they should correspond to the PPT old/new types in the order of fileId, concatenated into a string separated by English commas. The number of types in type must match the number of IDs contained in fileId.]
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtained by registering on the Polyv official website: Official Website -> Login -> Live (Development Settings).
appSecret false String POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtained by registering on the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

true indicates successful document deletion, false indicates failed document deletion.




5. Instructor Document Relationship Management

Description

开启了“讲义库”功能后(如需开通请联系售后),通过此接口将讲师和公共讲义库中的文档关联起来,从而实现在不需要重复上传的情况下,多个讲师共用同一份文档
接口地址(仅做说明使用):https://api.polyv.net/live/v4/channel/doc/teacher/update-relation

Call Constraints

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

Unit Test

    @Test
    public void testUpdateTeacherDocRelation() throws IOException, NoSuchAlgorithmException {
        LiveTeacherDocRelationRequest liveTeacherDocRelationRequest = new LiveTeacherDocRelationRequest();
        Boolean liveTeacherDocRelationResponse;
        try {
            liveTeacherDocRelationRequest.setTeacherId("4047763")
                    .setFileIds("702eaad1e22b218b79285eab77410af84047763common")
                    .setOperation(2);
            liveTeacherDocRelationResponse = new LiveChannelDocServiceImpl().UpdateTeacherDocRelation(
                    liveTeacherDocRelationRequest);
            Assert.assertNotNull(liveTeacherDocRelationResponse);
            if (liveTeacherDocRelationResponse != null) {
                //to do something ......
                log.debug("测试讲师文档关系管理成功 {}", JSON.toJSONString(liveTeacherDocRelationResponse));
            }
        } 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 Boolean object is returned. The B-side 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(), e.g., [Input parameter [xxx.chat.LivexxxRequest] object validation failed, failed field [pic cannot be empty / msg cannot be empty]].

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

Request Parameter Description

Parameter Name Required Type Description
operation true Integer Operation. 1: Add binding relationship. If the binding relationship already exists, it will not be added again; only the association time is updated. The list query defaults to sorting in descending order by this association time. 2: Remove binding relationship.
teacherId true String Instructor ID, up to 32 ASCII visible characters. This is the customTeacherId passed in the [Create Channel API] or [Update Channel API].
fileIds true String Document ID(s). Multiple document IDs are separated by commas. A maximum of 100 IDs can be passed at a time.
appId false String POLYV user APP_ID. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtained by registering on the Polyv official website: Official Website -> Login -> Live (Development Settings).
appSecret false String POLYV user APP_SECRET. Required for multi-account calls (i.e., when initMultiAccount() is called for multi-account setup). Obtained by registering on the Polyv official website: Official Website -> Login -> Live (Development Settings).

Return Object Description

true indicates successful relationship modification, false indicates failed relationship modification.

联系客服,在线咨询