cancel
Showing results for 
Search instead for 
Did you mean: 
saelterman
Community Participant

Quizzes Submissions API returns empty list

Jump to solution

I am attempting to get the results of quizzes (by question by student, because the available student analysis report isn't great for importing in our data warehouse) using the API.

This call results in a response with empty quiz_submissions and submissions properties. Both the quiz and the course ID exist; they were retrieved from prior API calls.

I am an admin for the account.

What am I overlooking? Or is there a different API that would provide me with each students quiz results by question?

https://mydomain.instructure.com/api/v1/courses/{{CourseID}}/quizzes/{{QuizID}}/submissions?include=submission

Labels (1)
1 Solution

Accepted Solutions
James
Community Champion

Is there some undocumented time restriction after which submissions can no longer be retrieved?

I have not seen any limitation on the CSV report. I just went back to Fall 2012, which was our first semester with Canvas, and downloaded a Student Analysis report from then and it came through as expected.

The Quiz Submission Events API requires that you enable Quiz Logging and nothing that was taken before you enabled that will be retrievable.

I have seen limits on how much history appears in the event logs. I don't know if it's date related or volume related. I did go back to last summer and fall. The last quiz from summer, due July 19, 2017, does not have event data. My first quiz from the fall of last year, due August 31, 2017, does have event data.

We have several different tests and each test having essentially a different schema makes it very time consuming to develop an ETL process for our data warehouse.

That difficulty may be part of the reason that Canvas doesn't provide us with the student answers in Canvas Data. Or maybe they don't think there's enough demand for it?

A complete analysis of the student response data would probably involve looking at the quiz submission data as well. The questions can change from student to student. By change, I mean you can get different questions (question groups) and different wording for the same question (quiz versions). That is not contained in the CSV file, just the response and then just for certain question types. I had great difficulty in multiple response questions trying to find the answers when I just based it off the values in the CSV since their delimiter was one that I used in my responses. Looking through the available options probably would have made that easier.

You're not alone in wanting to do this. There was a feature request (or two or maybe three) where people wanted the CSV file improved, but they never reached critical mass. I think there was a group of people who have written some code to process that CSV file and merge results into something usable and I want to say they did it in R.

I suppose that one way to get the information would be to self-host and then you would have direct access to the database. I'm not recommending that, just trying to think of possibilities.

View solution in original post

5 Replies
MattHanes
Community Champion

It doesn't seem like you are missing anything. I just ran the call in Postman on a fake quiz in one of my courses and it definitely returned information. So that call does work. I could only say to verify the course and quiz ids one more time.

270934_pastedImage_1.png

James
Community Champion

 @saelterman ,

 @MattHanes  checked the API call, which I was able to verify as well. I'm reading it differently and not as concerned about that as I am your use of "by question" a couple of times.

Are you looking for the responses to the individual questions for each student on each quiz?

The generally reported way is through generating the student analysis report, either through the web UI or through the Quiz Reports API. That CSV file is not the easiest format to work with.

For the request you're making, the include=submission doesn't include the submission responses, it includes the summary information about the submission (date, seconds late, score, etc)

The only place I have found to obtain answers to individual questions directly through the API is the Quiz Submission Events API. Not listed in the documentation for retrieving the information is the query parameter attempt= that will allow you to retrieve the results for an attempt other than the last one. It's not particularly easy to use either as it gives all of the answers and so you have to keep track of timing to make sure you get the last one that was actually submitted.

saelterman
Community Participant

Thanks for the quick reply. Using an incorrect course or quiz ID results in this JSON (with HTTP status 404):

{
    "errors": [
        {
            "message": "The specified resource does not exist."
        }
    ],
    "error_report_id": 1474087530
}

But I am actually getting an empty quiz_submissions array with HTTP 200.

However, I did try with two other course and quiz IDs (which are more recent) and it worked fine (i.e. I received an array of submissions). I tried a second older course and received an empty response again.

Is there some undocumented time restriction after which submissions can no longer be retrieved?

I am testing the API endpoint suggested by James to see if I receive similar results.

PS: I did also try to enroll myself as a teacher in the course where I receive no results. I still receive the empty response then.

saelterman
Community Participant

Are you looking for the responses to the individual questions for each student on each quiz?

Yes, correct.

That CSV file is not the easiest format to work with.

Correct again Smiley Happy You're on a roll. We have several different tests and each test having essentially a different schema makes it very time consuming to develop an ETL process for our data warehouse.

Therefore, I am hoping to simply retrieve the results "by question by student" to either generate our own flat file format or add directly in the data warehouse.

I am now researching the Quiz Submission Events API like you suggested. I hope it doesn't suffer from the same apparent issue as the Quiz Submission API I discovered above:

Is there some undocumented time restriction after which submissions can no longer be retrieved?

Thanks for helping!

James
Community Champion

Is there some undocumented time restriction after which submissions can no longer be retrieved?

I have not seen any limitation on the CSV report. I just went back to Fall 2012, which was our first semester with Canvas, and downloaded a Student Analysis report from then and it came through as expected.

The Quiz Submission Events API requires that you enable Quiz Logging and nothing that was taken before you enabled that will be retrievable.

I have seen limits on how much history appears in the event logs. I don't know if it's date related or volume related. I did go back to last summer and fall. The last quiz from summer, due July 19, 2017, does not have event data. My first quiz from the fall of last year, due August 31, 2017, does have event data.

We have several different tests and each test having essentially a different schema makes it very time consuming to develop an ETL process for our data warehouse.

That difficulty may be part of the reason that Canvas doesn't provide us with the student answers in Canvas Data. Or maybe they don't think there's enough demand for it?

A complete analysis of the student response data would probably involve looking at the quiz submission data as well. The questions can change from student to student. By change, I mean you can get different questions (question groups) and different wording for the same question (quiz versions). That is not contained in the CSV file, just the response and then just for certain question types. I had great difficulty in multiple response questions trying to find the answers when I just based it off the values in the CSV since their delimiter was one that I used in my responses. Looking through the available options probably would have made that easier.

You're not alone in wanting to do this. There was a feature request (or two or maybe three) where people wanted the CSV file improved, but they never reached critical mass. I think there was a group of people who have written some code to process that CSV file and merge results into something usable and I want to say they did it in R.

I suppose that one way to get the information would be to self-host and then you would have direct access to the database. I'm not recommending that, just trying to think of possibilities.

View solution in original post