Showing results for 
Search instead for 
Did you mean: 
Community Member

.NET/C# Wrapper for API

Is there anyone who's built a .NET library to wrap common Canvas API calls? It seems that most are questions here are reinventing the wheel. It would be nice to have a library (official or not) that would take care of the common things like the OAuth2 workflow and token refreshes.

It would also be really helpful to just have the class definitions of the different objects, such as User, Course, etc.

If not, and I started such a project to be hosted on GitHub or VSTS and distributed via NuGet, who might join? (Not looking for commitment, just seeing how many people would find this worthwhile.)

Tags (2)
9 Replies
Community Member

I have a written a C# .NET async wrapper for making calls to the Canvas API. Unfortunately, due to contractual constraints I can't release that code publicly (as much as I would like to). 

However if there were a project to release a public wrapper via GitHub, I'm sure I could be cajoled into getting involved with that for the community. Smiley Wink

Surveyor II‌ I posted sample code exactly for this, you can find it here:

I created the project only as an example of how to make Canvas API calls, there is no real "business logic".

Let me know if it's helpful.‌: this looks helpful. Thanks for providing this.

I haven't yet looked at the source, but should it prove useful, would you consent to some of it being re-used with attribution in an open-source library?

Community Member

After posting my message, I found this GitHub repo which is a PowerShell module but uses class definitions which could be re-used for C#‌ feel free to reuse any part of that project, no problem at all.

There is plenty of room for optimization.  I tried to keep the code readable and easy to follow and not make it cryptic.

If any questions come up let me know.

As I mentioned, there is no proprietary business logic in there, no "intellectual property", it's simply an example of one way to make API calls using .NET : )

Community Member

Garth, this is exactly what I've been looking for - especially the OAuth workflow. 

Thanks! Awesome, it's nice to know it's helping someone, thanks for letting me know Smiley Happy Link no more available on GitHub

Tags (2)

@nahmed2k6 these post are from 2017 I don't think they are still alive... do you need powershell or a C# wrapper.  if you do need a C# wrapper... you can take a look at ours its been well thought out and kept up to date since we use it to run our school.