Quiz Submission Questions
API for answering and flagging questions in a quiz-taking session.
A QuizSubmissionQuestion object looks like:
Quizzes::QuizSubmissionQuestionsController#index
GET /api/v1/quiz_submissions/:quiz_submission_id/questions
GET /api/v1/quiz_submissions/:quiz_submission_id/questions
Scope: url:GET|/api/v1/quiz_submissions/:quiz_submission_id/questions
Get a list of all the question records for this quiz submission.
200 OK response code is returned if the request was successful.
Request Parameters:
Parameter | Type | Description |
---|---|---|
|
| Associations to include with the quiz submission question. Allowed values: |
Example Response:
Quizzes::QuizSubmissionQuestionsController#answer
POST /api/v1/quiz_submissions/:quiz_submission_id/questions
POST /api/v1/quiz_submissions/:quiz_submission_id/questions
Scope: url:POST|/api/v1/quiz_submissions/:quiz_submission_id/questions
Provide or update an answer to one or more QuizQuestions.
Request Parameters:
Parameter | Type | Description |
---|---|---|
| Required | The attempt number of the quiz submission being taken. Note that this must be the latest attempt index, as questions for earlier attempts can not be modified. |
| Required | The unique validation token you received when the Quiz Submission was created. |
|
| Access code for the Quiz, if any. |
|
| Set of question IDs and the answer value.
See Appendix: Question Answer Formats for the accepted answer formats for each question type. |
Example Request:
Returns a list of QuizSubmissionQuestion objects.
Quizzes::QuizSubmissionQuestionsController#formatted_answer
GET /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/formatted_answer
GET /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/formatted_answer
Scope: url:GET|/api/v1/quiz_submissions/:quiz_submission_id/questions/:id/formatted_answer
Matches the intended behavior of the UI when a numerical answer is entered and returns the resulting formatted number
Request Parameters:
Parameter | Type | Description |
---|---|---|
| Required | no description |
Example Response:
Quizzes::QuizSubmissionQuestionsController#flag
PUT /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/flag
PUT /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/flag
Scope: url:PUT|/api/v1/quiz_submissions/:quiz_submission_id/questions/:id/flag
Set a flag on a quiz question to indicate that you want to return to it later.
Request Parameters:
Parameter | Type | Description |
---|---|---|
| Required | The attempt number of the quiz submission being taken. Note that this must be the latest attempt index, as questions for earlier attempts can not be modified. |
| Required | The unique validation token you received when the Quiz Submission was created. |
|
| Access code for the Quiz, if any. |
Example Request:
Quizzes::QuizSubmissionQuestionsController#unflag
PUT /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/unflag
PUT /api/v1/quiz_submissions/:quiz_submission_id/questions/:id/unflag
Scope: url:PUT|/api/v1/quiz_submissions/:quiz_submission_id/questions/:id/unflag
Remove the flag that you previously set on a quiz question after you’ve returned to it.
Request Parameters:
Parameter | Type | Description |
---|---|---|
| Required | The attempt number of the quiz submission being taken. Note that this must be the latest attempt index, as questions for earlier attempts can not be modified. |
| Required | The unique validation token you received when the Quiz Submission was created. |
|
| Access code for the Quiz, if any. |
Example Request:
Appendixes
Appendix: Question Answer Formats
.appendix_entry div.syntaxhighlighter table { width: 100%; }
.appendix_entry h4 { color: green; }
Essay Questions
Question parametric type:
essay_question
Parameter type:
Text
Parameter synopsis:
{ "answer": "Answer text." }
Example request
Possible errors
HTTP RC | Error Message | Cause |
---|---|---|
400 Bad Request |
| The answer text is larger than the allowed limit of 16 kilobytes. |
Fill In Multiple Blanks Questions
Question parametric type:
fill_in_multiple_blanks_question
Parameter type:
Hash{String => String}
Parameter synopsis:
{ "answer": { "variable": "Answer string." } }
Example request
Given that the question accepts answers to two variables, color1
and color2
:
Possible errors
HTTP RC | Error Message | Cause |
---|---|---|
400 Bad Request |
| The answer map contains a variable that is not accepted by the question. |
400 Bad Request |
| The answer text is larger than the allowed limit of 16 kilobytes. |
Fill In The Blank Questions
Question parametric type:
short_answer_question
Parameter type:
String
Parameter synopsis:
{ "answer": "Some sentence." }
Example request
Possible errors
Similar to the errors produced by Essay Questions.
Formula Questions
Question parametric type:
calculated_question
Parameter type:
Decimal
Parameter synopsis:
{ "answer": decimal }
wheredecimal
is either a rational number, or a literal version of it (String)
Example request
With an exponent:
With a string for a number:
Possible errors
HTTP RC | Error Message | Cause |
---|---|---|
400 Bad Request |
| The specified value could not be processed as a decimal. |
Matching Questions
Question parametric type:
matching_question
Parameter type:
Array<Hash>
Parameter synopsis:
{ "answer": [{ "answer_id": id, "match_id": id }] }
where the IDs must identify answers and matches accepted by the question.
Example request
Given that the question accepts 3 answers with IDs [ 3, 6, 9 ]
and 6 matches with IDs: [ 10, 11, 12, 13, 14, 15 ]
:
The above request:
pairs
answer#6
withmatch#10
pairs
answer#3
withmatch#14
leaves
answer#9
un-matched
Possible errors
HTTP RC | Error Message | Cause |
---|---|---|
400 Bad Request |
| The match-pairings set you supplied is not an array. |
Multiple Choice Questions
Question parametric type:
multiple_choice_question
Parameter type:
Integer
Parameter synopsis:
{ "answer": answer_id }
whereanswer_id
is an ID of one of the question's answers.
Example request
Given an answer with an ID of 5:
Possible errors
HTTP RC | Error Message | Cause |
---|---|---|
400 Bad Request |
| The specified `answer_id` is not an integer. |
400 Bad Request |
| The specified `answer_id` is not a valid answer. |
Multiple Dropdowns Questions
Question parametric type:
multiple_dropdowns_question
Parameter type:
Hash{String => Integer}
Parameter synopsis:
{ "answer": { "variable": answer_id } }
where the keys are variables accepted by the question, and their values are IDs of answers provided by the question.
Example request
Given that the question accepts 3 answers to a variable named color
with the ids [ 3, 6, 9 ]
:
Possible errors
HTTP RC | Error Message | Cause |
---|---|---|
400 Bad Request |
| The answer map you supplied contains a variable that is not accepted by the question. |
400 Bad Request |
| An |
Multiple Answers Questions
Question parametric type:
multiple_answers_question
Parameter type:
Array<Integer>
Parameter synopsis:
{ "answer": [ answer_id ] }
where the array items are IDs of answers accepted by the question.
Example request
Given that the question accepts 3 answers with the ids [ 3, 6, 9 ]
and we want to select the answers 3
and 6
:
Possible errors
HTTP RC | Error Message | Cause |
---|---|---|
400 Bad Request |
| The selection set you supplied is not an array. |
400 Bad Request |
| One of the answer IDs you supplied is not a valid ID. |
Numerical Questions
Question parametric type:
numerical_question
This is similar to Formula Questions.
True/False Questions
Question parametric type:
true_false_question
The rest is similar to Multiple Choice questions.
© Instructure, Inc. Generated on Wed Nov 6 14:20:08 2024 This documentation is generated directly from the Canvas LMS source code, available on Github.
Last updated