协议版本:v0.1.0
Protocol Version:v0.1.0
[TOC]
通过每课的 API Server,你可以获得学生、老师、教室等数据以进行校园相关应用开发。
特别提醒:所有线上服务,协议版本均应保持版本号前两位为一致的。
更新原则:若只发生文档更新,前两位版本号将不发生变化。若接口内容发生变化,协议版本号前两位将会被更新并写入更新日志。
初始版本,未发布前版本
- 因课程相关用词体系修改,原有
course_list
修改为card_list
。 course_list
中原有的course_code
修改为card_code
。course_list
中原有的class
修改为tea_class
表示一个行政班。- 每个card中添加
course_code
字段,表示课程号(如:140102X1)。
- 学生信息中新增新增
campus
字段,表示学生所在校区。 - 教师信息中新增新增
degree
字段,表示教师学历(可能是空字符串)。 - 更新学生信息获取方式,优先获取当前学期的信息。
- 改用Flask后端框架
- 基础修正
- 运行全局配置化
- DataDog分环境启动
- 基础接口
- 更新格式
- 移除监控检查
- 数据更新时间恢复真实性
- 搜索接口
- status 全部改成OK
- 允许分组搜索
- type改为group
- 移除分页信息
- 移除XXX_code,整体改用code
- 新增空教室搜索
- 新增教室位置分组
- 修正空教室接口中的逻辑错误(配合数据层修改)
- 迁移空教室接口URL
- 新增教室状态查询接口
- 修改教室分组信息响应格式,新增教室名称
-
说明:基本连通性测试接口
-
请求示例:
GET /
-
响应示例:
{ "code": 92000, "data": { "info": "Hello, world!", "status": "success" }, "method": "hello_world", "status": "OK", "time": 1589279052, "timestamp": "2020-05-12 18:24:13" }
-
说明:主要提供服务状态、数据版本、接口版本等信息
-
请求示例:
GET /info/service
-
响应示例:
{ "code": 92000, "data": { "data_time": "2020-04-26", "service_notice": "服务正常运行", "service_state": "running", "status": "success", "version": "0.3.0" }, "method": "service_info", "status": "OK", "time": 1589279872, "timestamp": "2020-05-12 18:37:52" }
-
说明:提供首页搜索功能服务接口
-
请求示例:
GET /search/query?key=fhx&group=teacher
-
参数(Query string):
key
:字符串,搜索值(搜索字符串最短不可小于2个字符)group
:字符串,搜索分类(可在course
,teacher
,student
,room
中选择一项)
-
说明:
- 支持使用简拼、全拼、中文全字进行搜索,例如搜索“每课”,可通过"mk"、"meike"、“每课”进行搜索,暂不支持其他搜索方案。
- 若姓名中出现符号,可以忽略符号进行拼音搜索。例如搜索“每·课”,可通过"mk"、"meike"、“每·课”进行搜索,暂不支持其他搜索方案。
- 外籍学生若使用中文名称可使用拼音搜索,若使用英文名称,请使用完整的姓名进行搜索。
- Foreign students can use Pinyin search if they use Chinese names. If they use English names, please use the full name to search.
-
响应示例:
{ "status": "success", "data": [ { "code": "0201130230", "name": "返魂香", "group": "teacher", "title": "副教授", "unit": "软件学院", "semester_list": [ "2018-2019-1", "2016-2017-1", "2016-2017-2", "2017-2018-1", "2017-2018-2", "2018-2019-2" ] }, { "code": "0201130230", "name": "范海辛", "group": "student", "deputy": "文学院", "class": "城地1602", "semester_list": [ "2016-2017-1", "2016-2017-2" ] } ] }
-
URL:
/card/{课程编号}/timetable/{学期}
-
方法:
GET
-
说明:
- 学期格式形如:
2018-2019-1
- 响应中不包含该课程的其他学期,semester字段仅表示响应数据所属的学期。
- 学期格式形如:
-
请求示例:
GET /card/0D8EAEC14F3E4EE38C039C6072218FA7/timetable/2018-2019-1
-
响应示例:
{ "status": "success", "name": "Web应用开发技术", "room": "世B502", "hour": 32, "type": "专业选修课", "picked": 95, "lesson": "10506", "tea_class": "软件1701-03", "card_code": "0D8EAEC14F3E4EE38C039C6072218FA7", "room_code": "2430502", "week_list": [11,12,13,14,15,16,17,18], "course_code": "140102X1", "week_string": "11-18/全周", "semester": "2018-2019-1", "student_list": [ { "name": "毕水秀", "student_code": "1909170222", "class": "软件1703", "deputy": "软件学院" }, { "name": "周福", "student_code": "0304170106", "class": "软件1701", "deputy": "软件学院" } ], "teacher_list": [ { "name": "外聘1", "teacher_code": "0000187", "title": "教授", "unit": "软件学院" } ] }
-
说明:提供校区、教学楼、教室之间的层级关系
-
请求示例:
GET /room GET /room/ GET /room/group
-
响应示例:
{ "room_group": { "南校区": { "一教": { "1310419": "一教419", "1310420": "一教0420" }, "三教": { "351104": "三教104", "351203": "三教203", "351301": "三教301", "351302": "三教302", "351303": "三教303", "351304": "三教304", "351305": "三教305" }, "二教": { "324204": "二教204", "324207": "二教207", "1320213": "二教213", "1320216": "二教216" } } }, "status": "OK" }
-
请求示例:
GET /room/available?week=12&session=50102&campus=新校区&building=B座
-
参数(Query string):
week
:字符串,周次(必填)session
:字符串,节次(必填)campus
:字符串,校区(可选,参照/room
返回值)building
:字符串,建筑(可选,参照/room
返回值)
-
说明:
- 填充参数
building
时必须填充campus
参数
- 填充参数
-
响应示例:
{ "available_room": [ { "code": "9020101", "name": "B座101", "status": "available" }, { "code": "9020103", "name": "B座103", "status": "available" } ], "status": "OK" }
-
请求示例:
GET /room/status?week=12&session=50102&campus=新校区&building=B座
-
参数(Query string):
week
:字符串,周次(必填)session
:字符串,节次(必填)campus
:字符串,校区(可选,参照/room
返回值)building
:字符串,建筑(可选,参照/room
返回值)
-
说明:
- 填充参数
building
时必须填充campus
参数
- 填充参数
-
响应示例:
{ "room_status": [ { "code": "9020101", "data": {}, "name": "B座101", "status": "available" }, { "code": "9020102", "data": { "course_code": "200104Z10", "course_name": "法学名著导读课程", "lesson": "BF20370294AA46958E96EBEEE915EFF6" }, "name": "B座102", "status": "active" } ], "status": "OK" }
-
URL:
/room/{教室编号}/timetable/{学期}
-
方法:
GET
-
说明:
- 学期格式形如:
2018-2019-1
- 响应中不包含该课程的其他学期,semester字段仅表示响应数据所属的学期。
- 学期格式形如:
-
请求示例:
GET /room/2430402/timetable/2018-2019-1
-
响应示例:
{ "status": "success", "name": "世B402", "campus": "铁道校区", "building": "世B", "room_code": "2430402", "semester": "2018-2019-1", "semester_list": [ "2018-2019-1", "2016-2017-1", "2016-2017-2", "2017-2018-1", "2017-2018-2", "2018-2019-2" ] "card_list": [ { "name": "毛泽东思想与中国特色社会主义理论体系概论", "room": "世B402", "lesson": "10506", "card_code": "F3AA2FE5715C4CDFAAB1DDE56B500097", "room_code": "2430402", "week_list": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18], "week_string": "1-18/全周", "course_code": "140102X1", "teacher_list": [ { "teacher_code": "119043", "name": "胡厚荣", "title": "高级政工师" } ] }, { "name": "毛泽东思想与中国特色社会主义理论体系概论", "room": "世B402", "lesson": "10506", "card_code": "F3AA2FE5715C4CDFAAB1DDE56B500097", "room_code": "2430402", "week_list": [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18], "week_string": "1-18/全周", "course_code": "140102X1", "teacher_list": [ { "teacher_code": "119043", "name": "胡厚荣", "title": "高级政工师" } ] } ] }
-
URL:
{host}/student/{学生编号}
-
方法:
GET
-
请求示例:
GET /student/3901160407
-
响应示例:
{ "status": "success", "name": "詹泽宇", "student_code": "3901160407", "deputy": "计算机学院", "class": "软件1604", "campus": "铁道校区", "semester_list": [ "2018-2019-1", "2016-2017-1", "2016-2017-2", "2017-2018-1", "2017-2018-2", "2018-2019-2" ] }
-
URL:
{host}/student/{学生编号}/timetable/{学期}
-
方法:
GET
-
说明:
- 学期格式形如:
2018-2019-1
- 学生编号格式:编号包含数字与字母
- semester字段:仅表示响应数据所属的学期。
- 学期格式形如:
-
请求示例:
GET /student/3901160407/timetable/2018-2019-1
-
响应示例:
{ "status": "success", "name": "詹泽宇", "student_code": "3901160407", "deputy": "计算机学院", "class": "软件1604", "campus": "铁道校区", "semester": "2018-2019-1", "semester_list": [ "2018-2019-1", "2016-2017-1", "2016-2017-2", "2017-2018-1", "2017-2018-2", "2018-2019-2" ], "card_list": [ { "name": "日语(二外)", "room": "世B102", "lesson": "10102", "card_code": "10B1D23F9CFA4FC6BD885904C07FA7AB", "room_code": "2430102", "week_list": [3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18], "course_code": "390121Z10", "week_string": "3-18/全周", "teacher_list": [ { "teacher_code": "702134", "name": "金涛", "title": "讲师(高校)" } ] }, { "name": "云计算及应用", "room": "世B402", "lesson": "30102", "card_code": "23AA42B2C02544828961859CB0E2F1E2", "room_code": "2430402", "week_list": [11,12,13,14,15,16,17,18], "course_code": "390121Z10", "week_string": "11-18/全周", "teacher_list": [ { "teacher_code": "212178", "name": "邓磊", "title": "副教授" } ] }, ... ] }
-
URL:
{host}/teacher/{教师编号}
-
方法:
GET
-
说明:
-
学期格式形如:
2018-2019-1
-
请求示例:
GET /teacher/212178
-
响应示例:
{ "status": "success", "name": "邓磊", "unit": "软件学院", "title": "副教授", "degree": "博士毕业", "teacher_code": "131352", "semester_list": [ "2018-2019-1", "2016-2017-1", "2016-2017-2", "2017-2018-1", "2017-2018-2", "2018-2019-2" ] }
-
URL:
{host}/teacher/{教师编号}/timetable/{学期}
-
方法:
GET
-
说明:
- 学期格式形如:
2018-2019-1
- 教师编号格式:编号包含数字与字母
- semester字段:仅表示响应数据所属的学期。
- 学期格式形如:
-
请求示例:
GET /teacher/212178/timetable/2018-2019-1
-
响应示例:
{ "status": "success", "name": "邓磊", "unit": "软件学院", "title": "副教授", "degree": "博士毕业", "semester": "2018-2019-1", "teacher_code": "131352", "semester_list": [ "2018-2019-1", "2016-2017-1", "2016-2017-2", "2017-2018-1", "2017-2018-2", "2018-2019-2" ], "card_list": [ { "name": "大型数据库技术", "room": "世B402", "lesson": "10102", "card_code": "12E4C3DCB631491DB7F56F13873349C1", "room_code": "2430402", "week_list": [3,4,5,6,7,8,9,10], "course_code": "390121Z10", "week_string": "3-10/全周", "teacher_list": [ { "teacher_code": "邓磊", "name": "212178", "title": "副教授" } ] }, { "name": "云计算及应用", "room": "世B402", "lesson": "10102", "card_code": "42654979C8F540BA9956AFF401E73F5B", "room_code": "2430402", "week_list": [11,12,13,14,15,16,17,18], "course_code": "390121Z10", "week_string": "11-18/全周", "teacher_list": [ { "teacher_code": "邓磊", "name": "212178", "title": "副教授" } ] }, ... ] }
在数据交换的过程中出现的以下键值,可以按照以下解释理解含义。
名称 | 含义 | 类型 |
---|---|---|
klass | ||
course | 两个连续的课时 | |
class | 学生所属班级(非行政班) | |