[关闭]
@fuyb1986 2017-05-19T10:23:44.000000Z 字数 3057 阅读 525

班级管理

冰橙课件


加入班级申请

Method and URL Structure

Method Resource URL Authorization
POST /api/classroom/join/${pk}/ YES

cURL Example

  1. 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

  1. {
  2. "count":1,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "pk":1,
  7. "name":"三年级(9)班",
  8. "created":"2017-05-17T17:58:58.894193",
  9. "teacher":{
  10. "pk":101,
  11. "owner":101,
  12. "nickname":"xiaoming",
  13. "avatar_url":"http://www.example.com/xiaoming.jpg",
  14. "slogan":"xiaoming's slogan",
  15. "name":"赵小明",
  16. "sex":"M",
  17. "sex_display":"男",
  18. "birthday":"1990-01-01"
  19. }
  20. }]
  21. }

通过申请

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

  1. {
  2. "student": 99
  3. }

cURL Example

  1. 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

  1. {
  2. "profile":{
  3. "pk":99,
  4. "owner":99,
  5. "nickname":"xiaoer",
  6. "avatar_url":"http://www.example.com/wangxiaoer.jpg",
  7. "slogan":"wangxiaoer's slogan",
  8. "name":"王小二",
  9. "sex":"M",
  10. "sex_display":"男",
  11. "birthday":"1990-01-01"
  12. }
  13. }

拒绝申请

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

  1. {
  2. "student": 100
  3. }

cURL Example

  1. 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

  1. curl -X GET -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/api/classroom/student_list/313/

Response

  1. {
  2. "count":1,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "profile":{
  7. "pk":212,
  8. "owner":212,
  9. "nickname":"xiaoming",
  10. "avatar_url":"http://www.example.com/xiaoming.jpg",
  11. "slogan":"xiaoming's slogan",
  12. "name":"赵小明",
  13. "sex":"M",
  14. "sex_display":"男",
  15. "birthday":"1990-01-01"
  16. }
  17. }]
  18. }

申请加入的学生

Method and URL Structure

Method Resource URL Authorization
GET /api/classroom/application_list/${pk}/ YES

cURL Example

  1. curl -X GET -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/api/classroom/application_list/313/

Response

  1. {
  2. "count":1,
  3. "next":null,
  4. "previous":null,
  5. "results":[{
  6. "profile":{
  7. "pk":202,
  8. "owner":202,
  9. "nickname":"xiaoming",
  10. "avatar_url":"http://www.example.com/xiaoming.jpg",
  11. "slogan":"xiaoming's slogan",
  12. "name":"赵小明",
  13. "sex":"M",
  14. "sex_display":"男",
  15. "birthday":"1990-01-01"
  16. }
  17. }]
  18. }

从班级删除学生

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

  1. {
  2. "student": 100
  3. }

cURL Example

  1. curl -X DELETE -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' --data '{"student": 100}' http://localhost/api/classroom/remove_student/393/
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注