老师的课程安排、选课
儿童编程
获取课程安排列表
Method and URL Structure
Method |
Resource URL |
Authorization |
GET |
/classroom/classschedules/ |
YES |
Requeset Paramters
学生只能从明天以及明天之后开始的课程里选课
Name |
Description |
Required |
Default |
week |
从本周算起前/后 N 周的 |
NO |
|
day |
前/后 N 天开始的 |
NO |
|
teacher |
老师的用户名 |
No |
|
day: N 天之前或之后开始的;
等于 0: 今天;
大于 0: N 天之后;
小于 0: N 天之前;
week 前/后 N 周之七天的;
等于0: 本周;
大于0: N周之后;
小于0: N周之前;
没有办主任的学生,可以用 ?teacher=18516xxxx 来获取老师的安排
cURL Example
curl -X GET -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/classroom/classschedules/?day=1
Response Data
Name |
Description |
pk |
id |
starttime |
开始时间 |
endtime |
结束时间 |
teacher |
老师 id |
status |
状态 |
students |
对应的教室的学生列表 |
lesston_total |
占用的课 |
Status
Name |
Description |
0 |
待选 |
1 |
占用 |
2 |
已选 |
Response
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"pk": 5227,
"starttime": "2017-06-09T19:30:00",
"endtime": "2017-06-09T20:30:00",
"quantity": 0,
"teacher": 1,
"status": 2,
"lesson_total": 1.0,
"students": [{
"name": "小丽",
"owner": "1234567890"
},.. ]
},
....
]
}
选课
Method and URL Structure
Method |
Resource URL |
Authorization |
POST |
/classroom/classschedule/choice/${pk}/ |
YES |
cURL Example
curl -X POST -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/classroom/classschedule/choice/5227/
Response
{
"status": 0,
"message": ""
}
取消选课
Method and URL Structure
Method |
Resource URL |
Authorization |
DELETE |
/classroom/classschedule/cancel/${pk}/ |
YES |
Requeset Paramters
Name |
Description |
Required |
Default |
Comment |
student |
学生的用户名 |
NO |
|
管理员取消教室时需要传递这个参数 |
cURL Example
curl -X DELETE -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/classroom/classschedule/cancel/5227/
Response
{
"status": 0,
"message": ""
}
创建教室
只有管理员调用这个接口
Method and URL Structure
Method |
Resource URL |
Authorization |
POST |
/classroom/classschedule/create_classroom/${pk}/ |
YES |
Requeset Paramters
Name |
Description |
Required |
Default |
student |
学生的用户名 |
YES |
|
cURL Example
curl -X POST -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/classroom/classschedule/ceate_classroom/5227/
Response
{
"status": 0,
"message": ""
}
创建上课安排
Method and URL Structure
Method |
Resource URL |
Authorization |
POST |
/classroom/create_schedule/ |
YES |
Requeset Paramters
Name |
Description |
Required |
Default |
start_time |
安排开始时间戳(秒) |
YES |
|
end_time |
安排开始时间戳(秒) |
YES |
|
quantity |
教室数量 |
YES |
1 |
hours |
教室时间 |
YES |
1.0 |
Request Data
{
"start_time": 1522328400,
"end_time": 1522332000,
"quantity" : 2,
"hours": 1.5
}
cURL Example
curl -X POST -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' --data '{...}' http://localhost/classroom/classschedule/ceate_schedule/
Response
{
"status": 0,
"message": ""
}
删除上课安排
Method and URL Structure
Method |
Resource URL |
Authorization |
DELETE |
/classroom/classschedule/delete/ |
YES |
cURL Example
curl -X DELTE -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/classroom/delete/12345/
Response
{
"status": 0,
"message": ""
}