Canvas cURL pagination: doesn't include "last" page link?

Community Novice

For my project I need to get all the pages of data for a project.

I can make cURL requests on data endpoints and get all the pages I want. For example, see this DD of some page data that includes all four links: "Current", "Next", "Last" and "First":

array:4 [  0 => "Link: <>; rel="current""   1 => "<>; rel="next""   2 => "<>; rel="first""   3 => "<>; rel="last"\r"]

However, sometimes when I get page link data, they will not include the "last" field, I'll only have the first three to work with: "Current", "Next" and "First":

array:3 [  0 => "Link: <>; rel="current""   1 => "<>; rel="next""   2 => "<>; rel="first"\r"]

To clarify, in that above example, I can confirm there are far more pages than just two, there are at least seven. So I know there are many more pages to fetch, but for some reason I don't understand, there isn't a "last" link available.

For my project, I want to be able to always link to the last page, so having that "Last" link would be very valuable.

I have read the Canvas API documentation on Pages, on Endpoints, and on Courses and Users among other pages, but nothing there seems to have the solution.

Here are two URLs that make sure to include the "last" page:



Here are some which don't.



Does anyone know how I might be able to get it? Or have any ideas that might point me in the right direction? Any help at all would be greatly appreciated

Labels (4)