保利威文档中心

幫助中心

查詢課節已上傳文件列表

更新時間:2024-10-21 09:33:43

接口描述

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

接口URL

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

請求方式

GET

接口約束

1、接口同時支援 HTTP、HTTPS,建議使用 HTTPS 確保接口安全,接口呼叫有頻率限制,詳細請查看

請求參數描述

參數名 必選 類型 說明
appId true String 帳號 appId【詳見取得金鑰
timestamp true Long 當前 13 位毫秒級時間戳,3 分鐘內有效
sign true String 簽名,為 32 位大寫的 MD5 值,產生簽名的 appSecret 金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有 API 都必須透過客戶自己伺服器中轉呼叫 POLYV 伺服器取得回應資料【詳見簽名產生規則
lessonId true Long 課節號
status false String 文件狀態,預設不傳查詢所有
normal:正常
waitUpload:等待上傳
failUpload:上傳失敗
waitConvert:轉換 PPT 中
failConvert:轉換 PPT 失敗
page false Integer 第幾頁,預設不傳顯示第一頁
limit false Integer 每頁顯示幾筆資料,預設不傳顯示 10 筆
isShowUrl false String 是否展示文件原始檔案地址,預設不傳不展示
Y:是
N:否

範例

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

回應參數描述

參數名 類型 說明
code Integer 回應狀態碼,200 為成功返回,非 200 為失敗【詳見全域錯誤說明
status String 回應狀態文字資訊
error Error 錯誤物件【詳見全域錯誤說明
data Object 請求成功時為已上傳文件的相關資訊【詳見Data 參數描述】,請求失敗時為空
Data 參數描述
參數名 類型 說明
pageSize Integer 每頁資料大小,預設 10,最大值 1000
pageNumber Integer 當前的頁數
totalItems Integer 總筆數
contents Array 查詢的結果列表【詳見Contents 參數描述
startRow Integer 當前頁第一筆記錄在總結果集中的位置
firstPage Boolean 是否為第一頁,值為:true/false
lastPage Boolean 是否為最後一頁,值為:true/false
prePageNumber Integer 上一頁編號
nextPageNumber Integer 下一頁編號
limit Integer 每頁數量大小
totalPages Integer 總頁數
endRow Integer 當前頁最後一筆記錄在總結果集中的位置
offset Integer 分頁起始記錄
Contents 參數描述
參數名 類型 說明
fileId String 檔案 ID
fileName String 檔案名稱
fileUrl String 檔案 URL
fileType String 檔案類型
totalPage Integer 上傳文件的內容總頁數
channelId String 頻道號
status String 文件狀態,不傳預設查詢所有
normal:正常
waitUpload:等待上傳
failUpload:上傳失敗
waitConvert:轉換 PPT 中
failConvert:轉換 PPT 失敗
createTime Long 建立時間,13 位毫秒級時間戳
convertType String 轉換類型,預設不傳轉普通,因為只有 ppt、pptx 可以轉動畫,其他類型檔案會自動轉成普通;檔案轉動畫轉失敗會直接把類型轉為普通
common:轉普通圖片
animate:轉動畫效果
previewImage String PPT 預覽小圖地址
previewBigImage String PPT 預覽大圖地址
autoId Integer 文件 ID

Java 請求範例

快速接入基礎程式碼請下載相關依賴原始碼點擊下載原始碼,下載後加入到自己的原始碼工程中即可。測試案例中的 HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。

強烈建議您使用直播 Java SDK 完成 API 的功能對接,直播 Java SDK 對 API 呼叫邏輯、異常處理、資料簽名、HTTP 請求執行緒池進行了統一封裝和最佳化。

/**
 * 查询课节已上传文档列表
 * @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);
}

回應範例

系統全域錯誤說明詳見全域錯誤說明

成功範例

{
    "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
}

異常範例

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