保利威文档中心

幫助中心

恢復課節狀態為可以上課

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

介面描述

1、恢复课节状态为可以上课(如果课节已到达下课时间,则不允许再上课)
2、接口URL中的{lessonId}为课节号
3、接口支持https协议

介面URL

http://api.polyv.net/hi-class-api/open/lesson/v1/{lessonId}/resume

請求方式

POST

介面限制

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

請求參數描述

參數名 必選 類型 說明
appId true String 帳號appId【詳見取得金鑰
timestamp true Long 當前13位毫秒級時間戳,3分鐘內有效
sign true String 簽名,為32位大寫的MD5值【詳見簽名產生規則
userId true String POLYV用戶ID,與保利威官網一致,取得路徑:官網->登入->直播(開發設定)

範例

http://api.polyv.net/hi-class-api/open/lesson/v1/11687/resume

表單參數:

appId=fyirmfdak4&timestamp=1636339754708&sign=F79C16196B1E8DE8DF474B4E1034875B&userId=17e1c4f329

回應參數描述

參數名 類型 說明
code Integer 回應狀態碼,200為成功返回,非200為失敗【詳見全域錯誤說明
status String 回應狀態文字資訊
error Error 錯誤物件【詳見全域錯誤說明
data Object 請求失敗時為空,請求成功時為修改狀態相應結果 【詳見data欄位描述

data欄位描述

參數名 類型 說明
status boolean 操作狀態。true:成功;false:失敗

Java請求範例

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

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

private static final Logger log = LoggerFactory.getLogger(ChannelStateTest.class);
/**
 * 禁止直播频道推流
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testCutoff() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String userId = super.userId;
    String timestamp = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/hi-class-api/open/lesson/v1/%s/resume";
    String lessonId = "11687";
    
    url = String.format(url, lessonId);
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("userId", userId);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.postFormBody(url, requestMap);
    log.info("恢复课节状态为可以上课,返回值:{}", response);
    //do somethings
    
}

回應範例

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

成功範例

{
  "code": 200,
  "status": "success",
  "data": {
    "status": true
  },
  "success": true
}

異常範例

{
  "code": 400,
  "status": "error",
  "error": {
    "code": 1012,
    "desc": "输入的userId有误"
  },
  "data": null,
  "success": false
}
联系客服,在线咨询