[ARCHIVED] Canvas Quiz Submission API does not return all submissions

Jump to solution
mrahman_bcc
Community Member

Hi I am new to Canvas API usage.

I am trying to write a script using PowerShell that needs to grab all submissions data of a particular quiz in a section (Submission Time, Kept Score, User ID etc). I am using the following API call:

$url = "https://$domain/api/v1/courses/<course #>/quizzes/<quiz #>/submissions?include[]=user"

using the following invoke-webrequest block:

$quizObject = Invoke-WebRequest -Headers $headers -Method Get -Uri $url |
convertfrom-json |
select -expand quiz_submissions |
select user_id, finished_at, kept_score | export-csv -path quizObjectOutput.csv -NoTypeInformation

I am able to get data back, use the JSON data etc and get my script to do everything I needed to do.

The issue is, I am only getting partial data back, exactly 10 submissions. I exported the grade book via GUI and can see I there are roughly 50 submissions for the quiz. Is there any API limitation that I am not aware of? Why I am not getting all 50 submissions?

any help is appreciated!! I have hit the brick wall with this!!

Update: 

I found this - which seems to answer why I am getting only 10 results because responses are paginated.

https://community.canvaslms.com/t5/Question-Forum/get-all-quiz-submissions/m-p/421241/highlight/true...

what it does not tell me is How do I know how many pages I have beforehand? 
How am I supposed to loop through the pages if I don't know how many pages are out there?

Labels (2)
0 Likes
1 Solution

hmm I'm not familiar with Powershell. I found this, don't know if it is helpful? Screenshot 2021-01-14 at 16.10.31.png

View solution in original post