Showing results for 
Show  only  | Search instead for 
Did you mean: 
New Member

API List Multiple Submissions - next page


I'm having trouble pulling all submissions for a course. We have 20+ assignments per course, and I don't want to write tons of API calls to handle that. Using the multiple assignment submissions API I can get up to 100 results with the per_page header. But I can't offset or do any pagination to get to the next few hundred results. Would love some help!!


Labels (1)
0 Kudos
4 Replies
Community Champion

Hi Emily, 

In case you haven't seen it, the documentation on how the Canvas API handles pagination is here:

Endpoints that return paginated results will also return a Link header that includes the URLs for other pages of results relative to the current page. Many HTTP request libraries (like the Python requests library, for example) will parse the Link header for you and make it easy to access the next/previous/first/last pages of results. The typical pattern to fetch all results is:

1. Request the first page of results

2. If the response's Link header includes a URL for the next page of results, fetch that page and add to the list returned in step 1. 

3. Repeat step 2 until the response no longer contains a "next" URL in the Link header. 

Hopefully this is helpful! 



New Member

@ColinMurtaugh Thanks so much for your response! I've been using API clients (like the google sheets add-on) that have let me escape learning Python for these things, but I definitely want to get fancier. Any suggestions for learning Python specifically for API calls? Thanks!!

Hey @ehicksrotella

I use both Google Apps script and Python for Canvas work. There are two things I'd suggest:

1. Check out the canvasapi library for Python from UCF. It handles all of the routing, pagination, and requests allowing you to focus on doing stuff in Canvas without worrying about how to make the connection. It's amazing. If you want some examples, I have a collection of my own scripts which rely on that library for the heavy lifting.

2. I also run scripts in Google Apps to write directly to spreadsheets for other people (so I'm not always running Python scripts for them). If you want, I have a snippet here you can copy/paste into a project which will handle pagination of requests for you.

I'm also working on a more robust Apps Script library for Canvas that models the Python library for more full-featured interaction with Canvas in that environment.

New Member

Thank you so much @bbennett2 for this genius share. I've got a lot to learn. Luckily I can also use a google sheets add-on to take the easy route for now.