获取课节信息
更新时间:2024-10-21 09:33:43
接口描述
1、获取课节信息
2、接口支持https协议
接口URL
http://api.polyv.net/hi-class-api/open/lesson/v1/get
请求方式
POST
接口约束
1、接口同时支持HTTP 、HTTPS ,建议使用HTTPS 确保接口安全,接口调用有频率限制,详细请查看
请求参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| appId | true | String | 账号appId【详见获取密钥】 |
| timestamp | true | Long | 当前13位毫秒级时间戳,3分钟内有效 |
| sign | true | String | 签名,为32位大写的MD5值【详见签名生成规则】 |
请求体参数描述
| 参数名 | 必选 | 类型 | 说明 |
|---|---|---|---|
| lessonId | true | Long | 课节号 |
示例
http://api.polyv.net/hi-class-api/open/lesson/v1/get?appId=frlr1zazn3&sign=A80D0E7115D0D1BF5648AE2AB123C0FD×tamp=1621839827266
请求体参数
{
"lessonId": 1
}
响应参数描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| code | Integer | 响应状态码,200为成功返回,非200为失败【详见全局错误说明】 |
| status | String | 响应状态文本信息 |
| error | Error | 错误对象【详见全局错误说明】 |
| data | Object | 请求失败时为空,请求成功时为课节信息 【详见data字段描述】 |
data字段描述
| 参数名 | 类型 | 说明 |
|---|---|---|
| lessonId | Long | 课节ID |
| name | String | 课节名称 |
| teacherId | String | 老师ID |
| teacherCode | String | 老师登录手机区号 |
| teacherMobile | String | 老师账号 |
| teacherPasswd | String | 老师账号密码 |
| startTime | Long | 开始时间,格式为: 13位时间戳 |
| endTime | Long | 结束时间,格式为: 13位时间戳 |
| duration | Integer | 上课时长,单位: 分钟 |
| status | Integer | 课节状态 0:未开始 1:上课中 2:已下课 11:禁止上课 |
| linkNumber | Integer | 连麦人数 0 - 16 |
| autoConnectMicroEnabled | String | 是否自动连麦 Y:自动连麦 N:手动上麦 |
| autoRecordCourseEnabled | String | 是否自动录制课程 Y:自动录制 N:手动录制 |
| watchCondition | String | 观看条件 NULL:无条件 CODE:验证码 WHITE_LIST:白名单 DIRECT:独立授权 |
| code | String | 观看密码,当观看条件为CODE时需要填写密码 |
| secretKey | String | 授权观看KEY |
| cover | String | 封面URL |
| resolution | Integer | 录制清晰度, 720, 1080 |
| playResolution | Integer | 上课清晰度, 360 |
Java请求示例
快速接入基础代码请下载相关依赖源码, 点击下载源代码 ,下载后加入到自己的源码工程中即可。测试用例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下载文件中。
/**
* 获取课节信息
* @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
}
响应示例
系统全局错误说明详见全局错误说明
成功示例
{
"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
}
异常示例
{
"code": 400,
"status": "error",
"data": "",
"error": {
"code": xx,
"desc": "错误描述"
}
}
