班级管理
冰橙课件
加入班级申请
Method and URL Structure
Method |
Resource URL |
Authorization |
POST |
/api/classroom/join/${pk}/ |
YES |
cURL Example
curl -X POST -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/api/classroom/join/134/
Response Data
Name |
Description |
pk |
id |
name |
名称 |
created |
创建时间 |
teacher |
老师个人信息 |
Response
{
"count":1,
"next":null,
"previous":null,
"results":[{
"pk":1,
"name":"三年级(9)班",
"created":"2017-05-17T17:58:58.894193",
"teacher":{
"pk":101,
"owner":101,
"nickname":"xiaoming",
"avatar_url":"http://www.example.com/xiaoming.jpg",
"slogan":"xiaoming's slogan",
"name":"赵小明",
"sex":"M",
"sex_display":"男",
"birthday":"1990-01-01"
}
}]
}
通过申请
Method and URL Structure
Method |
Resource URL |
Authorization |
POST |
/api/classroom/join/accept/${pk}/ |
YES |
Request Pramaters
Name |
Description |
Required |
Default |
student |
学生 id |
YES |
|
Request Data
{
"student": 99
}
cURL Example
curl -X POST -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' --data '{"student": 99}' http://localhost/api/classroom/join/accept/199/
Response Data
Name |
Description |
profile |
学生用户信息 |
Response
{
"profile":{
"pk":99,
"owner":99,
"nickname":"xiaoer",
"avatar_url":"http://www.example.com/wangxiaoer.jpg",
"slogan":"wangxiaoer's slogan",
"name":"王小二",
"sex":"M",
"sex_display":"男",
"birthday":"1990-01-01"
}
}
拒绝申请
Method and URL Structure
Method |
Resource URL |
Authorization |
DELETE |
/api/classroom/join/reject/${pk}/ |
YES |
Request Pramaters
Name |
Description |
Required |
Default |
student |
学生 id |
YES |
|
Request Data
{
"student": 100
}
cURL Example
curl -X DELETE -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' --data '{"student": 100}' http://localhost/api/classroom/json/reject/393/
班级里的学生
Method and URL Structure
Method |
Resource URL |
Authorization |
GET |
/api/classroom/student_list/${pk}/ |
YES |
cURL Example
curl -X GET -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/api/classroom/student_list/313/
Response
{
"count":1,
"next":null,
"previous":null,
"results":[{
"profile":{
"pk":212,
"owner":212,
"nickname":"xiaoming",
"avatar_url":"http://www.example.com/xiaoming.jpg",
"slogan":"xiaoming's slogan",
"name":"赵小明",
"sex":"M",
"sex_display":"男",
"birthday":"1990-01-01"
}
}]
}
申请加入的学生
Method and URL Structure
Method |
Resource URL |
Authorization |
GET |
/api/classroom/application_list/${pk}/ |
YES |
cURL Example
curl -X GET -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/api/classroom/application_list/313/
Response
{
"count":1,
"next":null,
"previous":null,
"results":[{
"profile":{
"pk":202,
"owner":202,
"nickname":"xiaoming",
"avatar_url":"http://www.example.com/xiaoming.jpg",
"slogan":"xiaoming's slogan",
"name":"赵小明",
"sex":"M",
"sex_display":"男",
"birthday":"1990-01-01"
}
}]
}
从班级删除学生
Method and URL Structure
Method |
Resource URL |
Authorization |
DELETE |
/api/classroom/remove_student/${pk}/ |
YES |
Request Pramaters
Name |
Description |
Required |
Default |
student |
学生 id |
YES |
|
Request Data
{
"student": 100
}
cURL Example
curl -X DELETE -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' --data '{"student": 100}' http://localhost/api/classroom/remove_student/393/