Degraded AWS performance is currently impacting some Canvas users in the North American region. Check Canvas Status for updates.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
greg_zhang
Community Member

Course API page is not working

Jump to solution

I was using this API to get all users enrolled in course, there are more than 1000 users in the course, it worked before , but now no matter the page is it's only return same 100 results. 

/api/v1/courses/8773/enrollments?per_page=100&page=1

/api/v1/courses/8773/enrollments?per_page=100&page=2

0 Kudos
1 Solution

Accepted Solutions
James
Community Champion

 @greg_zhang  

Canvas has switched to using bookmarks for the enrollments API and the numeric pages are no longer supported. See 2020-06-20 in the Canvas API change log. It was announced several months before (I don't remember when exactly, but I was warning people about it back in February 2020). Still several people missed the announcement.

Officially, they were never supported, they were just used and a bunch of people wrote their code based off the pattern that was used. You need to follow the documentation on using Pagination about using the Next link header to determine the proper page in the sequence.

View solution in original post

0 Kudos
3 Replies
James
Community Champion

 @greg_zhang  

Canvas has switched to using bookmarks for the enrollments API and the numeric pages are no longer supported. See 2020-06-20 in the Canvas API change log. It was announced several months before (I don't remember when exactly, but I was warning people about it back in February 2020). Still several people missed the announcement.

Officially, they were never supported, they were just used and a bunch of people wrote their code based off the pattern that was used. You need to follow the documentation on using Pagination about using the Next link header to determine the proper page in the sequence.

View solution in original post

0 Kudos
greg_zhang
Community Member

We have some customers may on different version of the Canvas? Do you know what is the earliest version is change apply to? and is there any API to get the version number?

 

thanks

 

Greg

James
Community Champion

If you fix your code to use the Next link header as Canvas has told people to do for years, then it doesn't matter what version of Canvas you're on and it will work even if the page number route works.

What I do is check the link headers and look at the form it takes. Then it doesn't matter because I've accounted for both patterns. If it the value for page is numeric and there is a Last header, then you can use the numbered pagination. If the page comes back starting with bookmark: then you cannot.