Courses API Limit Help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to find a quick and easy way to get this API call to return the full list of course users. Right now, it is only returning the top 100 and not obeying the per_page=500 statement. We are in the midst of using the API within an LTI tool for final grade submission and courses over 100 students are not able to submit final grades successfully.
https://ourdomain.instructure.com/api/v1/courses/COURSEID/users?enrollment_type=student&per_page=500;
Any ideas?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There isn't a way to force the Canvas API to give you more results. There is a cap on the number of results (that varies depending on the API) any request will return.
You have two options that I am aware of.
The first option you have is to continue with the API endpoint as you are doing now. You will need to modify the LTI tool to pull the paginated results (see the documentation here) one page at a time until there are no more pages.
The second option would be to run a provisioning or sis export report via the API and use the enrollments list in the generated CSV. The API endpoint for doing that is described at Account Reports API. Aside from being able to cache this data locally for a time, there are several advantages to doing it this way. Triggering the report requires only one API call, the CSV report is created on the backend, and you just have to create a way to download the data when it is ready. There are a few examples of this in a community repository of scripts in github at https://github.com/kajigga/canvas-contrib/tree/master/API_Examples/report.