AnsweredAssumed Answered

Canvas API Quiz Events Inconsistent, At Best.

Question asked by Matthew Byrd on Dec 11, 2017
Latest reply on Dec 11, 2017 by Kelley L. Meeusen

I'm having some trouble querying the quiz events of the Canvas API. For example, when I use a simple python script to get the events:

api_target = '{}/api/v1/courses/{}/quizzes/{}/submissions/{}/events'

# Builds a dictionary containing events linked to student canvas ids
quiz_events = {}
for submission_id, user_id in self.submissions[0]:
   events = requests.put(api_target.format(self.url, self.class_id, self.quiz_id, submission_id),
                         headers=self.header)
   quiz_events[user_id] = events.json()

I always end up with data that does not match the "view log" section of quiz results. Notably, a student who left the page multiple times shows up as not leaving the page once in the API result.

 

Is there a way to rebuild the on the API end so that the data lines up properly with the "View Log"? Or is there something else I can do to get more consistent results? Because as of now this is leaving a project I'm working on impossible.

 

EDIT: THE PROBLEM WAS A SMALLER AMOUNT OF DATA BEING QUERYED, FIX:

api_target = '{}/api/v1/courses/{}/quizzes/{}/submissions/{}/events?per_page=50'

Outcomes