[关闭]
@fuyb1986 2017-05-27T06:00:07.000000Z 字数 2042 阅读 513

作业

冰橙课件


提交答案

用 secation 的 pk 提交答案

Method and URL Structure

Method Resource URL Authorization
POST /api/book/secation/${pk}/answer_exercise/ YES

Request Parematers

Name Description
exercise 习题 id
option 选项 id

Request

  1. {
  2. "answers": [
  3. {
  4. "exercise": 1,
  5. "option": 4
  6. },
  7. {
  8. "exercise": 2,
  9. "option": 8,
  10. },
  11. {
  12. "exercise": 3,
  13. "option": 12
  14. }
  15. ]
  16. }

cURL Example

  1. curl -X POST -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' --data '{...}' http://localhost/api/book/secation/1/answer_exercise/

Response Data

Name Description
pk id
secation 小节的 id
student 学生 id
answers 答案
exercise_detail 题目详情
option 答案选项
correct 是否正确

Response

  1. {
  2. "pk":1,
  3. "student":1,
  4. "secation":1,
  5. "answers":[{
  6. "pk":1,
  7. "exercise_datil": {
  8. ....
  9. },
  10. "option":4,
  11. "correct":true
  12. },{
  13. "pk":2,
  14. "exercise_datil": {
  15. ....
  16. },
  17. "option":8,
  18. "correct":true
  19. },{
  20. "pk":3,
  21. "exercise_datil": {
  22. ....
  23. },
  24. "option":12,
  25. "correct":false
  26. }]
  27. }

获取答题记录

用 secation 的 pk 获取答题记录

Method and URL Structure

Method Resource URL Authorization
GET /api/book/secation/${pk}/answer_record/ YES

cURL Example

  1. curl -X GET -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/api/book/secation/1/answer_record/

Response Data

Name Description
pk id
secation 小节的 id
student 学生 id
answers 答案
exercise_detail 题目详情
option 答案选项
correct 是否正确

Response

  1. {
  2. "pk":1,
  3. "student":1,
  4. "secation":1,
  5. "answers":[{
  6. "pk":1,
  7. "exercise_datil": {
  8. ....
  9. },
  10. "option":4,
  11. "correct":true
  12. },{
  13. "pk":2,
  14. "exercise_datil": {
  15. ....
  16. },
  17. "option":8,
  18. "correct":true
  19. },{
  20. "pk":3,
  21. "exercise_datil": {
  22. ....
  23. },
  24. "option":12,
  25. "correct":false
  26. }]
  27. }

老师获取学生答题记录

用 学生 的 pk 获取答题记录

Method and URL Structure

Method Resource URL Authorization
GET /api/book/student/${pk}/answer_record/ YES

cURL Example

  1. curl -X GET -H 'Authorization: token 95b7b4d8fff5d76c9d3d2954fe5c7d456c110a8c' -H 'Content-Type: application/json' http://localhost/api/book/student/101/answer_record/

Response Data

Name Description
pk id
secation 小节的 id
student 学生 id
answers 答案
exercise_detail 题目详情
option 答案选项
correct 是否正确

Response

  1. {
  2. "pk":1,
  3. "student":1,
  4. "secation":1,
  5. "answers":[{
  6. "pk":1,
  7. "exercise_datil": {
  8. ....
  9. },
  10. "option":4,
  11. "correct":true
  12. },{
  13. "pk":2,
  14. "exercise_datil": {
  15. ....
  16. },
  17. "option":8,
  18. "correct":true
  19. },{
  20. "pk":3,
  21. "exercise_datil": {
  22. ....
  23. },
  24. "option":12,
  25. "correct":false
  26. }]
  27. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注