Polyv Help Center

Help Center

Restore Lesson Status to Available for Class

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

API Description

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

API URL

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

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls are subject to rate limits. See details

Request Parameters Description

Parameter Required Type Description
appId true String Account appId See Obtaining 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/resume

Form Parameters:

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

Response Parameters 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. The test cases include HttpUtil.java and LiveSignUtil.java 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/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
    
}

Response Example

For global system 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
}
联系客服,在线咨询