Polyv Help Center

Help Center

Query Uploaded Document List for a Lesson

Updated: 2024-10-21 09:33:43

API Description

1、获取课节文档列表
2、接口支持https协议

API URL

http://api.polyv.net/hi-class-api/open/file/v1/doc-list

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameters Description

Parameter Required Type Description
appId true String Account appId See Get Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must never be saved or used directly on the client side. All APIs must be called through your own server to relay requests to the POLYV server to obtain response data. See Signature Generation Rules
lessonId true Long Lesson ID
status false String Document status. Default: query all if not passed.
normal: Normal
waitUpload: Waiting for upload
failUpload: Upload failed
waitConvert: Converting PPT
failConvert: PPT conversion failed
page false Integer Page number. Default: first page if not passed.
limit false Integer Number of records per page. Default: 10 if not passed.
isShowUrl false String Whether to display the original file URL. Default: not displayed if not passed.
Y: Yes
N: No

Example

http://api.polyv.net/hi-class-api/open/file/v1/doc-list?isShowUrl=Y&appId=z2gw5icesv&limit=10&sign=935F4C0CF3EB84A3EFB2BC691DB714A5&page=1&lessonId=6707&timestamp=1631780657591&status=normal

Response Parameters Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See Global Error Description
status String Response status text
error Error Error object. See Global Error Description
data Object On success, contains information about uploaded documents. See Data Parameter Description. On failure, it is empty.
Data Parameter Description
Parameter Type Description
pageSize Integer Number of records per page. Default: 10, maximum: 1000
pageNumber Integer Current page number
totalItems Integer Total number of records
contents Array Query result list. See Contents Parameter Description
startRow Integer Position of the first record on the current page in the total result set
firstPage Boolean Whether it is the first page. Values: true/false
lastPage Boolean Whether it is the last page. Values: true/false
prePageNumber Integer Previous page number
nextPageNumber Integer Next page number
limit Integer Number of records per page
totalPages Integer Total number of pages
endRow Integer Position of the last record on the current page in the total result set
offset Integer Pagination starting record
Contents Parameter Description
Parameter Type Description
fileId String File ID
fileName String File name
fileUrl String File URL
fileType String File type
totalPage Integer Total number of pages in the uploaded document
channelId String Channel ID
status String Document status. Default: query all if not passed.
normal: Normal
waitUpload: Waiting for upload
failUpload: Upload failed
waitConvert: Converting PPT
failConvert: PPT conversion failed
createTime Long Creation time, 13-digit millisecond timestamp
convertType String Conversion type. Default: convert to normal if not passed. Only ppt, 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.
common: Convert to normal image
animate: Convert to animation effect
previewImage String PPT preview thumbnail URL
previewBigImage String PPT preview large image URL
autoId Integer Document ID

Java Request Example

For quick integration, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. The HttpUtil.java and LiveSignUtil.java in the test cases are included in the downloaded file.

It is strongly recommended to use the Live Java SDK for API integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

/**
 * 查询课节已上传文档列表
 * @throws IOException
 */
@Test
public void testGetDocList() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = this.appId;
    String appSecret = this.appSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/hi-class-api/open/file/v1/doc-list";
    String lessonId = "7190";
    String status = "normal";
    String limit = "5";
    String page = "1";
    String isShowUrl = "Y";

    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("lessonId", lessonId);
    requestMap.put("status", status);
    requestMap.put("limit", limit);
    requestMap.put("page", page);
    requestMap.put("isShowUrl", isShowUrl);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试查询课节已上传文档列表:{}", response);
}

Response Example

For global error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "data": {
        "pageSize": 10,
        "pageNumber": 1,
        "totalItems": 1,
        "contents": [{
            "autoId": 2369343,
            "fileId": "42ba92e56017f4de261e692630447b662561988animate",
            "fileName": "test3.ppt",
            "fileUrl": "http://doc-2.polyv.net/sources/20210916/42ba92e56017f4de261e692630447b662561988animate.ppt",
            "fileType": ".ppt",
            "totalPage": 1,
            "channelId": "2561988",
            "status": "normal",
            "createTime": 1631950890000,
            "convertType": "common",
            "previewImage": "http://doc-2.polyv.net/images/2021/09/42ba92e56017f4de261e692630447b662561988animate/42ba92e56017f4de261e692630447b662561988animate_0000_s.jpeg",
            "previewBigImage": "http://doc-2.polyv.net/images/2021/09/42ba92e56017f4de261e692630447b662561988animate/42ba92e56017f4de261e692630447b662561988animate_0000.jpeg"
        }],
        "limit": 1,
        "totalPages": 1,
        "startRow": 1,
        "endRow": 1,
        "firstPage": true,
        "lastPage": true,
        "nextPageNumber": 1,
        "prePageNumber": 1,
        "offset": 0
    },
    "success": true
}

Error Example

{
  "code": 400,
  "status": "error",
  "data": "",
  "error": {
    "code": xx,
    "desc": "错误描述"
  }
}
联系客服,在线咨询