Skip to content

QuizView

binarybox edited this page Sep 26, 2017 · 1 revision

Introduction

The QuizView class is used to provide information about every quiz question, provided the user is allowed to see the quiz question. The class is also used to answer quiz questions.

Method Detais

'get'

Header: user id (for permissions), course id (from url), ordered position of module in coures (from url), ordered position of question in module (from url)

Response:

{
"id": number,
"question": string,
"imgage": string,
"answers": [{
           "id": number,
           "text": string,
           "img": string
           }]
}

Error:

Response: 400 if unauthorized // only allowed for user if it is the first in this course or if the user answered the questions before correct

'post'

Header: user id (for permissions), course id (from url)

Request:

[{
 "id": number "the quiz question id"
 "answers": [{
            "chosen": boolean "if true the user has checked this quiz question"
            "id": number "the id of the quiz answer"
            }]
}]

Response:

[{
"name": string "the title of the quiz question",
"solved": boolean "if the answer was correct"
}]

Response: 200 (correct answer, try saved), 400 unauthorized, 500+ serializer error

Error:

Response: 400 if unauthorized // only allowed for user if it is the first in this course or if the user answered the questions before correct

Clone this wiki locally