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.
Can reports for graded surveys be downloaded using the API? I am looking for a way to download the students' replies to a graded survey.
@pmorale5 , greetings! Due to the technical nature of this question, I'm going to share it with the Canvas Developers group in the Community to see if they can help!
Kona
Do you want the reports or do you want the student responses?
There is a Quiz Reports API that allows you to create a quiz report. When you make the call, you'll get an id. You periodically check back with that id in the get a quiz report endpoint. When it's ready, there will be a file property that has an url that can be used to download the report. Note that this file is not an API call and should not include the authorization header that API calls need.
The student_analysis report has some issues depending on the type of questions that you have. For example, if you have commas in your multiple answers question responses, you may have issues parsing it correctly. But you can get the report through the API.
You can also get the student submissions without generating the report using the Submissions API (not the Quiz Submissions API). Use the assignment_id from the quiz and then list assignment submissions. This will not include the student quiz results unless you add the query parameter include[]=submission_history. When you do that, there is a submission_history array that contains a submission_data property for each submission. The submission_data matches up to the answers from the quiz, including correct, points, question_id, text, and possibly answer_id for each question. This method does not return the text that was picked for multiple choice questions, it returns the id of the item picked. This means that there is some additional processing that is necessary and might be challenging to get if your survey questions were pulled from a question bank.
When using the Submissions API, is the assignment_id the same as the quiz_id? I am trying that and I'm getting a 404 response.
When using the reports approach. my GET requests get a 200 but my POST requests get a 400 error. Could this be a permissions issue?
Update: I found the assignment_id for the quizzes. I'm getting the submissions but my requests only return 10 items. Is there a parameter that can return all of the items at once?
You can usually receive up to 100 at a time by specifying per_page=100 as a query parameter. That number varies by API call and there is no universal number, but I have never seen it be more than 100 that is allowed. You can specify a larger number, but Canvas ignore it and cap it at the maximum allowed. But if none of your quizzes have more than 100 submissions, you can likely get all of the submissions for a single quiz with just one API call.
If you have more than 100 submissions, then you need to follow the rules for pagination to get additional requests beyond the allowed amount.
As you determined, the quiz ID is not the same as the assignment ID. Every object has an id and they cannot be mixed. Objects returned will often include related IDs -- the quiz object has an assignment_id property. The assignment object doesn't have a quiz_id property, but the body property contains the user id, quiz id, score, and time, so you can parse the string and get it from there.
The submission object has an assignment_id but not a quiz_id (directly). If the quiz / survey is automatically graded, then the submission.grader_id will be the opposite of the quiz_id. That is, if the quiz has an ID of 5782587, then the submission will have a grader_id of -5782587.
Thank you. I was able to implement the pagination as well.
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
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.