Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
Hi,
I work with Canvas API.
I have built a script that creates/updates/delete users and courses in Canvas with our SIS as source.
One component in my script is to get all course (7000) enrollments so I can compare where to do a update.
It takes a long time going thru all courses with API to get this.
Of experience, I know that Canvas hides API-parameters that are not documented officially. Like "recursive=1" when you get all sub-accounts.
Do anyone here know if there is a one-call trick to get all courses enrollments with API?
Regards
Hi Fredrik,
You might find the provisioning API or the diffing dataset identifier useful.
Diffing Data Set Identifier:
https://canvas.instructure.com/doc/api/sis_imports.html
https://community.canvaslms.com/thread/34202-using-diffingdatasetidentifier
Provisioning API:
https://canvas.instructure.com/doc/api/account_reports.html
There is also a good discussion on synchronization options:
Cheers,
Raj
The Provisioning or SIS reports @raj_veeravalli mentions are the only place to get this that doesn't require pagination, but if you want to automate fetching them, it's still going to require multiple API calls (3 or so, not thousands). API calls are supposed to be mostly immediate and it would take too long and too many resources to generate that on the fly.
However, it seems that it would be easier to track changes in the SIS from the SIS itself, rather than trying to pull all that information back from Canvas on a regular basis. I imagine that most systems have a timestamp of when changes were made (if not an audit log) and you may be able to query against that to see what needs changed. If nothing else, take the provisioning or SIS reports and use it as a starting point for a one-time upgrade, and then track changes from that point forward.
If you really need to get all 7000 enrollments through the API, then there are some ways that you can speed up the process. You will want to use a programming language that supports concurrent API calls. I use Node JS and we grab the first page of results, normally using a per_page of 50, to determine how many pages of there are then request the rest in parallel. I do limit the number of requests and throw in some throttling to make sure we don't exceed the limit.
It's summer term right now, so there aren't many courses in session, but at the end of the spring term, it took me a little over 3 minutes to fetch all of our current courses, get their enrollments, get the list of assignments for each of the courses, fetch all of the grades for all of the assignments, and student summary analytics for each course.
We're not quite as big as your 7000 enrollments, but we ended last term with 5280 students.
We went with option 2 and downloaded the data from the provisioning report to get a current snapshot of the system and managed the deltas thereon, via our change control process.
Most of my code is in Python and I do love the canvasapi from UCF, which makes it easier to write pythonic code with little work. Where the library is missing an option available via the API, direct calls are used. I found some very inspiring code from @maguire when investigating automation options.
Threading/asynchronous code to improve performance is on the wishlist, but we are also looking at Canvas Data as an alternative to the API. We are still very new to Canvas or any LMS.
There are a variety of places to get information from.
Even with those three, there are still some questions that still cannot be answered.
To participate in the Instructure Community, you need to sign up or log in:
Sign In