Polyv Help Center

Help Center

Modify Lesson Status to Disable Teaching

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

Interface Description

1、禁止课节上课,禁止有效期为24小时,24小时后会恢复课节允许上课(如果课节已到达下课时间,则不允许再上课)
2、接口URL中的{lessonId}为课节号
3、接口支持https协议

Interface URL

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

Request Method

POST

Interface Constraints

  1. The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details

Request Parameter 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 See Signature Generation Rules
userId true String POLYV user ID, consistent with the Polyv official website. Retrieval path: Official website -> Login -> Live Streaming (Development Settings)

Example

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

Form Parameters:

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

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See Global Error Description
status String Response status text message
error Error Error object See Global Error Description
data Object Empty on request failure; modification result on success See data field description

data Field Description

Parameter Type Description
status boolean Operation status. true: success; false: failure

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. HttpUtil.java and LiveSignUtil.java in the test case 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 pooling.

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/cutoff";
    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
    
}

Response Example

For system-wide global error descriptions, see Global Error Description

Success Example

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

Error Example

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