Polyv Help Center

Help Center

Update Lesson Information

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

API Description

1、更新课节信息
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议

API URL

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

Request Method

POST

API Constraints

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

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See details
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value See details

Request Body Parameter Description

Parameter Required Type Description
lessonId true Long Lesson ID
name false String Lesson name, length 1~128
startTime false Long Start time, format: 13-digit timestamp
duration false Integer Class duration, unit: minutes, 5~180
linkNumber false Integer Number of participants for mic connection, 0~16
autoConnectMicroEnabled false String Auto mic connection
Y: Auto connect
N: Manual connect
autoRecordCourseEnabled false String Auto course recording
Y: Auto record
N: Manual record
watchCondition false String Viewing condition
NULL: No condition
CODE: Verification code
WHITE_LIST: Whitelist
DIRECT: Independent authorization
code false String Viewing verification code required when watchCondition is CODE (max 16 characters)
secretKey false String Passed when watchCondition is DIRECT; auto-generated by backend if not provided (max 32 characters)
resolution false Integer Recording resolution, 720, 1080
playResolution false Integer Class resolution, 360 (contact relevant staff for higher resolutions)
cover false String Cover image URL, length 1~255
teacherId false String Teacher ID. If not provided, no update. If a new ID is provided, a new teacher is created based on the following teacher info
teacherName false String Teacher name. If existing teacher is found, the name will be updated
teacherCode false String Teacher's phone country code, default +86
teacherMobile false String Teacher's phone number, length 5~15
teacherPasswd false String Teacher password, length 6~8

Example

http://api.polyv.net/hi-class-api/open/lesson/v1/update?appId=frlr1zazn3&sign=FBEFF2002BBF2A78DD1639A06F590A7C&timestamp=1634629627718

Request Body Parameters

{
    "code": "5678",
    "linkNumber": "1",
    "teacherName": "六老师",
    "lessonId": "8970",
    "playResolution": "360",
    "teacherCode": "+86",
    "resolution": "720",
    "duration": "60",
    "cover": "https://liveimages.videocc.net/uploaded/images/2021/08/g1xcu49u12.jpg",
    "watchCondition": "CODE",
    "teacherId": "g3fdl05syf",
    "name": "测试修改课节",
    "teacherMobile": "15555555555",
    "startTime": "1634630909795",
    "autoConnectMicroEnabled": "N",
    "teacherPasswd": "123456"
}

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See details
status String Response status text
error Error Error object See details
data Object Null on failure; update status info on success See details

data Field Description

Parameter Type Description
status Boolean true: success; false: failure

Java Request Example

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

private static final Logger log = LoggerFactory.getLogger(VClassLessonTest.class);
/**
 * 更新课节信息
 * @throws IOException
 */
@Test
public void updateLesson() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());
    
    //业务参数
    String url = "http://api.polyv.net/hi-class-api/open/lesson/v1/update";
    String lessonId = "8970";
    String name = "测试修改课节";
    String startTime = "1634630909795";
    String duration = "60";
    String linkNumber = "1";
    String autoConnectMicroEnabled = "N";
    String watchCondition = "CODE";
    String code = "5678";
    String resolution = "720";
    String playResolution = "360";
    String cover = "https://liveimages.videocc.net/uploaded/images/2021/08/g1xcu49u12.jpg";
    String teacherId = "g3fdl05syf";
    String teacherName = "六老师";
    String teacherCode = "+86";
    String teacherMobile = "15555555555";
    String teacherPasswd = "123456";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    
    Map<String, Object> jsonMap = new HashMap<>();
    jsonMap.put("lessonId", lessonId);
    jsonMap.put("name", name);
    jsonMap.put("startTime", startTime);
    jsonMap.put("duration", duration);
    jsonMap.put("linkNumber", linkNumber);
    jsonMap.put("autoConnectMicroEnabled", autoConnectMicroEnabled);
    jsonMap.put("watchCondition", watchCondition);
    jsonMap.put("code", code);
    jsonMap.put("resolution", resolution);
    jsonMap.put("playResolution", playResolution);
    jsonMap.put("cover", cover);
    jsonMap.put("teacherId", teacherId);
    jsonMap.put("teacherName", teacherName);
    jsonMap.put("teacherCode", teacherCode);
    jsonMap.put("teacherMobile", teacherMobile);
    jsonMap.put("teacherPasswd", teacherPasswd);
    
    url = HttpUtil.appendUrl(url, requestMap);
    String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
    log.info("测试修改课节成功:{}", response);
}

Response Example

For system global error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "5bc5c3a4a88a487192cb0256b1dadb7f.97.16346296311239761",
    "data": {
        "status": true
    },
    "success": true
}

Error Example

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