cancel
Showing results for 
Search instead for 
Did you mean: 
ear15002
Community Member

Get student question answers submitted via API

Jump to solution

How do I get the answers and scores for individual questions on a quiz submissions? The Quiz Submission Question category claims to do this, but all I get is a slight variation of the Quiz Question Object. I know that it is all still under beta, but is there another way to get the individual question answers?

Labels (1)
1 Solution

Accepted Solutions
muh
Community Contributor

This API should be called (Quiz Submission Events - Canvas LMS REST API Documentation ) in your case. Then just loop through all the quiz_submission_ids, you should get what you want :-).

View solution in original post

12 Replies
muh
Community Contributor

This API should be called (Quiz Submission Events - Canvas LMS REST API Documentation ) in your case. Then just loop through all the quiz_submission_ids, you should get what you want :-).

View solution in original post

ear15002
Community Member

Thanks, somehow I missed that one.

sam_mcknight
Community Participant

Benjamin, were you able to get this working? Each time I call the quiz submission event API, I see three question_answered events for each submission I look at. The first event has null or blank arrays for all the answers. The second and third events have the answer provided by the student for a specific question. Problem is, the quiz has 30+ questions. If I download the quiz response report inside Canvas and open it in Excel, I see that the students have answered the questions. I must be doing something wrong with the API but I'm not sure what to correct.

acbart
Community Participant

As  @sam_mcknight ‌ suggests, it appears that this returns null and blank arrays instead of the expected values? Is this API broken? Here is an example of the returned results. I can see the result just fine in Canvas.

{'created_at': '2017-10-15T01:10:43Z',
'event_data': [{'answer': [{'answer_id': '',
                             'match_id': None},
                            {'answer_id': '',
                             'match_id': None},
                            {'answer_id': '',
                             'match_id': None},
                            {'answer_id': '',
                             'match_id': None},
                            {'answer_id': '',
                             'match_id': None},
                            {'answer_id': '',
                             'match_id': None}],
                 'quiz_question_id': '983744'},
                {'answer': None,
                 'quiz_question_id': '983745'},
                {'answer': None,
                 'quiz_question_id': '983749'},
                {'answer': [],
                 'quiz_question_id': '983751'},
                {'answer': {'': None},
                 'quiz_question_id': '983752'}],
'event_type': 'question_answered',
'id': '94746173'},
sam_mcknight
Community Participant

Not exactly broken. The API is marked as being in beta.

I got around this by writing a script that will download the csv quiz item analytics for me. I then combine those csv files and do my analytics.

The URL to use is /api/v1/courses/{CourseId}/quizzes/{QuizId}/reports. Add a form parameter to the header : quiz_report[report_type]=student_analysis. You will get back a Json object and two of its members are a filename and report id. Use the report id to go to /api/v1/courses/{CourseId}/quizzes/{QuizId}/reports/{ReportId}. This will then return the downloaded csv file.

You can do this in any language that allows http calls. In Python, it's really easy. You'll need to append your access_token as a URL parameter for each of these calls.

maguire
Community Champion

When I take the quiz as the test student, there are no results in the reports file. Is the test student automatically filtered out of the results? 

maguire
Community Champion

Note that the test student's answers can be seen in the "Show Student Survey Results", but not in the exported file.

z_dusatko
Community Participant

I am getting bad_request response ""quiz log auditing must be enabled".

pklove
Community Champion

Quiz log auditing can be enabled by an admin via Settings - Feature Options.  Its in the Course block.