作业
冰橙课件
提交答案
用 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
{
"answers": [
{
"exercise": 1,
"option": 4
},
{
"exercise": 2,
"option": 8,
},
{
"exercise": 3,
"option": 12
}
]
}
cURL Example
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
{
"pk":1,
"student":1,
"secation":1,
"answers":[{
"pk":1,
"exercise_datil": {
....
},
"option":4,
"correct":true
},{
"pk":2,
"exercise_datil": {
....
},
"option":8,
"correct":true
},{
"pk":3,
"exercise_datil": {
....
},
"option":12,
"correct":false
}]
}
获取答题记录
用 secation 的 pk 获取答题记录
Method and URL Structure
Method |
Resource URL |
Authorization |
GET |
/api/book/secation/${pk}/answer_record/ |
YES |
cURL Example
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
{
"pk":1,
"student":1,
"secation":1,
"answers":[{
"pk":1,
"exercise_datil": {
....
},
"option":4,
"correct":true
},{
"pk":2,
"exercise_datil": {
....
},
"option":8,
"correct":true
},{
"pk":3,
"exercise_datil": {
....
},
"option":12,
"correct":false
}]
}
老师获取学生答题记录
用 学生 的 pk 获取答题记录
Method and URL Structure
Method |
Resource URL |
Authorization |
GET |
/api/book/student/${pk}/answer_record/ |
YES |
cURL Example
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
{
"pk":1,
"student":1,
"secation":1,
"answers":[{
"pk":1,
"exercise_datil": {
....
},
"option":4,
"correct":true
},{
"pk":2,
"exercise_datil": {
....
},
"option":8,
"correct":true
},{
"pk":3,
"exercise_datil": {
....
},
"option":12,
"correct":false
}]
}