| February 16, 2022 | in
Canvas is one of the biggest names in the learning management software (LMS) space. It is used by major Universities across the country, and we use it for Nebraska Dev Lab and our Advanced Continuing Education.
LMSs provide an online structure for courses and content. This online nature makes it easier to support remote learners. The LMS also provides some organization to your class, which is always good.
If you use Canvas, you will probably find its UI limiting. But Canvas does have a really good REST API for querying.
Why would you use the Canvas API? Many things in Canvas are not easily determined by looking at the Canvas UI. For example, querying student progress across all courses isn’t possible. Most of the UI is very course-centric.
The first step in querying Canvas is creating an Access Token. Go to “Account | Settings” and click “New Access Token”.
Once you have an access token, you can make calls. In the .NET world, you should consider using RestSharp to make these REST calls a little easier.
dotnet add package RestSharp
Once you install RestSharp, you can make calls to Canvas. The code below will create an instance of RestClient. Then we make a call to get all accounts.
The Canvas API is pretty straightforward, but I found it had many obscure parameters. For example, if asked to sort the results based on last login, the last login time will be included in the response. But if you don’t ask to sort the data based on last login, you won’t get that data in the result.
Canvas has pretty good API documentation. Most of their calls are pretty consistent.
If you want to get all courses.
If you want to get all users in a course.
Determining some things, like % done for a course is a little trickier.
You can achieve quite a bit with Canvas and its API. I recommend going slow and testing out the Canvas API using Postman to figure out how it works. But once you get your head around it, you’ll find it pretty rich.