cancel
Showing results for 
Search instead for 
Did you mean: 
gerosullivan
Community Member

Module API only returning first 10 modules?

Jump to solution

When I run this request:

curl -H 'Authorization: Bearer <token>' https://<canvas>/api/v1/courses/148/modules

In the JSON that is returned I only get the first 10 modules in our course of 14 modules.

Is there a limit to the number of modules returned by the Canvas API? There doesn't seem to be anything about this in the API documentation.

Many thanks,

Ger

Labels (1)
Tags (2)
1 Solution

Accepted Solutions
themidiman
Community Champion

If you look at this part of the API documentation here it mentions that "Requests that return multiple items will be paginated to 10 items by default. You can set a custom per-page amount with the ?per_page paramenter"

View solution in original post

3 Replies
themidiman
Community Champion

If you look at this part of the API documentation here it mentions that "Requests that return multiple items will be paginated to 10 items by default. You can set a custom per-page amount with the ?per_page paramenter"

View solution in original post

Thanks Jeffrey. That really helped!

Summary for others (while adding additional include items parameter):

curl -H 'Authorization: Bearer <token>' https://<canvas>/api/v1/courses/148/modules?include=items&per_page=20

fpettigrosso
Community Participant

Hello, IF you need more than a hundred at a time. Please refer to pagination and this other link on how to actually do pagination.

https://canvas.instructure.com/doc/api/file.pagination.html

http://stackoverflow.com/questions/37732370/invoke-webrequest-canvas-lms-api-pagination

The second link will provide the actual process, if it helps