The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December.
Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
My academic department is planning to deploy a program assessment to all Canvas courses taught by department faculty members. The assessment will take the form of a short (original-style) Quiz that will be imported into all faculty Canvas courses. The quiz will have the same title in all courses.
After students complete the quiz, we want to retrieve all student responses for analysis using Python through the canvasapi library. If anyone has developed a Python script that already does this or something like it, I'd love to hear about it.
If not, I'm hoping to get a bit of help on a Python command sequence I've been working on to do the job.
I'm relatively new to the Canvas API. I've learned enough of the canvasapi library to figure out how to identify quizzes by title, and generate the Item Analysis report which contains the student responses to each question in CSV format.
I am stuck at the point of retrieving the CSV file that was generated by calling quiz.create_report(). I see there is a file id and a URL for the file embedded in the quiz.get_quiz_report() metadata. However, course.get_file() retrieves JSON-formatted data. So this command appears incompatible with the Item Analysis report in CSV format.
Thank you in advance for any solutions you can provide,
Kevin Healy
Mesa Community College, Mesa AZ
I created a script before that does something like this. I'm not able to share the full script at this time, but I can share some details about the process I used.
In my case, there was a survey created using Classic Canvas Quizzes that was added to a select set of courses that were piloting a new program and they wanted to aggregate the results.
To start, my script would read in a CSV file with the courses that I needed to get the data from. I used the provisioning report and filtered it to just the courses that needed to be included.
For each Canvas course ID, I then used the List quizzes in a course endpoint to get the quizzes in the course. I set the search_term query parameter to the expected name of the survey/quiz. *Note, if faculty change the name the appropriate quiz may not be found and if duplicates are created there may be multiple results found. There is also a chance some quizzes that aren't relevant are included if the search_term for the quiz name isn't sufficiently unique from other quiz names in a course.
After getting the quizzes, I then processed over all the found quizzes in the courses to get the questions from the quiz using the List questions in a quiz or submission endpoint. *Note, if changes are made to questions after some students already submitted, you may need to handle this differently. Since it seemed unlikely for questions to be edited on these standardized surveys, I used this approach so I only had to make the call once for each quiz rather than getting the questions for each submission.
I then used the Get all quiz submissions endpoint to get the submissions for each quiz in each course. For the include[] query parameter I used submission, submission_history, and user. *Note, 'submission_history' isn't documented as a valid query parameter so it may eventually no longer work, but for now it allows retrieving the actual student responses to the questions within the submission.
I then extracted and formatted the data that I needed for the requested report and wrote the data to a new CSV file.
Hi @Kevin_Healy,
Take a look at this script of mine: https://github.com/rootalley/du-math-placement-reporting, which I think will give you a start on this.
This is a tool I use internally to process our math placement exams, which are administered as a Canvas quiz. Within the quiz, questions are grouped together based on math placement level; i.e., questions 1–8 cover the most basic math topics, questions 9–16 cover the next higher level, and so on. The goal of the program is to total up the students' "subscores" for each topic, then use these to determine which math class the student should be placed in.
The program accepts as input the browser URL for the Canvas quiz you want to report on. Using this address, it calls the API to retrieve a list of the submissions to that quiz, then goes through all the questions and responses in turn. It tallies up the number of correct answers in each topic, then uses these scores
Be advised, this was a quick hack of a script that I never intended to share with anyone, so the code is a little rough. Still, I think this'll give you a working example of a script that uses the API to iterate through quiz questions and their responses.
Happy to connect and walk you through this if that would be helpful.
Steven Endres (he/him/his)
Director of Learning Technologies
Information Technology (Lewis 001A)
Dominican University | 7900 Division Street | River Forest, IL 60305
Mobile: (708) 466-9452 | sendres@dom.edu | Book a meeting with me
.................................
We are Dominican. We Go First.
Hi @sendres,
Your script sounds like a good example of what I'm trying to do. However, I get a 404 error when I follow the link to your script. When I look at your list of repositories on GitHub, I don't see one named "du-math-placement-reporting" or anything with a similar name. Is the script still available?
Thanks,
Kevin
Hi @Kevin_Healy,
Please retry the link; it should work for you now.
Related to the new quizzes and the api docs (New Quizzes - Canvas LMS REST API Documentation😞 I would like to retrieve scores / submissions for new quizzes. Is this currently possible, or should I revert to the student submissions endpoint, i.e. /students/submissions where the assignment ID's are specified in the URL - ../students/submissions?student_ids[]=all&assignment_ids[]=xxx etc.
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in