Skip to content

Pagination broken for enrollments API calls  #48

@pgoldweic

Description

@pgoldweic

My colleague and I realized that pagination seems to be broken in the wrapper for the enrollments API calls directed to our Canvas production instance (hosted). Since this is not so for the Canvas TEST instance (also hosted), we've theorized, after looking at the responses from both instances, that their format differs, and this appears to be the cause of the canvas-api-wrapper breakage (although we haven't really gone in and diagnosed the problem in detail). As a consequence of this problem, the wrapper returns only the first page of results when queried against the production Canvas instance.
The API call is as follows:
/ourdomain.instructure.com/api/v1/user/someuserid/enrollments

The response to this API call run against our TEST Canvas instance returns format as the following:
https://ourdomain.instructure.com/api/v1/users/someuserid/enrollments?page=1&per_page=10; rel="current",https://ourdomain.instructure.com/api/v1/users/someuserid/enrollments?page=2&per_page=10; rel="next",https:/ourdomain.instructure.com/api/v1/users/someuserid/enrollments?page=1&per_page=10;
rel="first",https://ourdomain.instructure.com/api/v1/users/someuserid/enrollments?page=2&per_page=10; rel="last"

(NOTE: this API call returns correctly more than 1 page)

However, the response from the production Canvas instance looks as follows:
https://canvas.ourdomain/api/v1/users/someuserid/enrollments?page=first&per_page=10; rel="current",https://canvas.ourdomain/api/v1/users/someuserid/enrollments?page=bookmark:WyJTdHVkZW50RW5yb2xsbWVudCIsIkthbm5lLCBLYXRoZXJpbmUiLDIyOTE3OTld&per_page=10; rel="next",https://canvas.ourdomain/api/v1/users/someuserid/enrollments?page=first&per_page=10; rel="first"

(notice the 'bookmark' substrings included; certainly different than the above).

In this case, the API call returns only one page of results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions