Community Member

Quiz Submission Questions API Not Returning 'answer' for Multiple Choice Question

I'm trying to gather data on if a student gets a question correct and if not which answer they chose. This is for a quiz with a Quiz Type of 'Practice Quiz'. (Classic Quiz)
From what I have read in the API documentation 'answer' should be returned for multiple choice questions. Is there some sort of setting that might be causing the 'answer' field to be excluded in the returned results?

I've tried changing the quiz type to something that would give it an assignment_id but still no luck.

Has anyone else seen this issue or knows how to get around it? I want to avoid the "assignment_id -> assignment_submissions -> include[]=submission_history" workaround.

0 Kudos
2 Replies
Community Champion


There are a couple of things going one here.

Try something other than a practice quiz. They don't count as regular submissions and things are handled differently.

Here are a couple of places where this question has been brought up in the past.

One way to make use a quiz without counting it is to use assignment groups with a weighted gradebook and then put the quizzes into an assignment group worth 0% of the grade.

You said that you tried different types and it didn't help, which gets to the second thing going on.

I've never (that I can recall) gotten answers out of the Quiz Submission Questions API. I believe it was written for the mobile app and delivering quizzes that students could take, not for people to get answers. Just because answer is part of the object doesn't mean that answer is returned by every API call that references that object.

I spent a lot of years trying to find a way to get the answers and never did through the API (other than generating a report) until I discovered the Submissions with include[]=submission_history approach. 

That's not going to help with practice quizzes since they don't make a submission.

0 Kudos
Community Member

Not sure if this helps or not, as I'm very new to Canvas, and am not familiar with practice quiz.

That said,

if the practice quiz requires that you start a quiz submission with the endpoint POST /api/v1/courses/:course_id/quizzes/:quiz_id/submissions,

then the endpoint will return a quizSubmission object with a key named validation_token.  This token is used as a parameter to the endpoint GET /api/v1/quiz_submissions/:quiz_submission_id/questions?validation_token=:validation_token, which will then return a QuizSubmissionQuestion object with an answer key (instead of the correct key).

Hope this helps.

0 Kudos