Get Lesson Information
Updated: 2024-10-21 09:33:43
Interface Description
1、获取课节信息
2、接口支持https协议
Interface URL
http://api.polyv.net/hi-class-api/open/lesson/v1/get
Request Method
POST
Interface Constraints
- The interface supports both HTTP and HTTPS. HTTPS is recommended for security. The interface has a call frequency limit. 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 |
Example
http://api.polyv.net/hi-class-api/open/lesson/v1/get?appId=frlr1zazn3&sign=A80D0E7115D0D1BF5648AE2AB123C0FD×tamp=1621839827266
Request Body Parameters
{
"lessonId": 1
}
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 | Empty on failure, lesson information on success See details |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| lessonId | Long | Lesson ID |
| name | String | Lesson name |
| teacherId | String | Teacher ID |
| teacherCode | String | Teacher login phone area code |
| teacherMobile | String | Teacher account |
| teacherPasswd | String | Teacher account password |
| startTime | Long | Start time, format: 13-digit timestamp |
| endTime | Long | End time, format: 13-digit timestamp |
| duration | Integer | Lesson duration, unit: minutes |
| status | Integer | Lesson status 0: Not started 1: In progress 2: Ended 11: Disabled |
| linkNumber | Integer | Number of participants in co-streaming, 0 - 16 |
| autoConnectMicroEnabled | String | Auto co-streaming Y: Auto co-streaming N: Manual co-streaming |
| autoRecordCourseEnabled | String | Auto course recording Y: Auto recording N: Manual recording |
| watchCondition | String | Viewing condition NULL: No condition CODE: Verification code WHITE_LIST: Whitelist DIRECT: Independent authorization |
| code | String | Viewing password, required when watch condition is CODE |
| secretKey | String | Authorization viewing KEY |
| cover | String | Cover URL |
| resolution | Integer | Recording resolution, 720, 1080 |
| playResolution | Integer | Playback resolution, 360 |
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 project. The HttpUtil.java and LiveSignUtil.java in the test cases are included in the downloaded file.
/**
* 获取课节信息
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void getLesson() 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/get";
String lessonId = "8970";
//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);
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.postJsonBody(url, JSON.toJSONString(jsonMap), null);
log.info("测试获取课节信息成功:{}", response);
//do somethings
}
Response Example
For global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"data": {
"lessonId": 3,
"lessonCode": "bmv87857",
"name": "课节ABC",
"status": 0,
"startTime": "2021-06-16 18:23",
"endTime": "2021-06-16 19:03",
"duration": 40,
"cover": "//s1.videocc.net/default-img/small-class/default-cover.png",
"teacherId": "fzkl43t2k1",
"teacherName": "张老师",
"webStartUrl": "https://s.vclass.com/live-web-hi-class/teacher/login?lessonId=3",
"watchStartUrl": "https://s.vclass.com/live-web-hi-class/student/login?lessonId=3",
"aloneWatch": "N",
"teacherCode": "+86",
"teacherMobile": "150188750789",
"teacherPasswd": "123456",
"linkNumber": 1,
"autoConnectMicroEnabled": "Y",
"autoRecordCourseEnabled": "Y"
},
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"data": "",
"error": {
"code": xx,
"desc": "错误描述"
}
}
