cancel
Showing results for 
Search instead for 
Did you mean: 
foncyc
Surveyor

API Pagination Parameters - &per_page &page

Do you guys have any idea why these parameters &per_page=100&page=3

work here
/api/v1/courses/:course_id/users?enrollment_role_id=3&per_page=100&page=3

but doesn't work here
/api/v1/courses/:course_id/enrollments?include[]=current_points&type[]=StudentEnrollment&per_page=100&page=3

i keep getting page 1 data

Labels (5)
0 Kudos
2 Replies
meinhoka
Surveyor II

I don't quite know why it works for one and not for the other, but here are a couple things to look at that may help point you in a direction to help you accomplish what you're trying to accomplish.

First, I'd recommend reading through this if you haven't already - https://community.canvaslms.com/t5/Developers-Group/Am-I-mistaken-or-is-pagination-in-the-quot-List-...

When looking in the developer tools in Chrome, you'll see the response headers for the links are treated a little different between "Users" and "Enrollments." Users will give you a response with page=2, page=3, etc., while Enrollments gives you a response with something like page=bookmark:Ftss3dy2xsbWVu...

You can use that "page=bookmark:..." response to jump to the different pages, but you don't know what bookmark: you're going to get for specific pages.

Hope that helps a little.

foncyc
Surveyor

I kinda figured we're gonna have to take the long road on this one. I just went ahead with the response headers -> next links.

Thanks @meinhoka