cancel
Showing results for 
Search instead for 
Did you mean: 
cholling
Adventurer III

API Calls?

 @James ‌ -- just curiosity on my part. What are API calls that people mention? Where do people add extensive HTML coding in Canvas -- is that something in a super admin or account level? I thought Canvas stripped out all but the most basic formatting tags.

Tags (3)
1 Reply
James
Navigator

cholling 

This is a big-picture response.

The Canvas REST API (API for short) is an interface for communicating with Canvas without using the web interface. This is great for automation and programming, which is really where it comes into play because it's not human friendly.

You can do a lot with it and some things are exposed through the API that are not available through the web interface. Vice-versa, some things are available through the web interface that are not available through the API. Early development of the API was to support the mobile apps, so anything that the mobile app can do is available in the API. Many of the things in the web interface make API calls as well. 

It has nothing to do with HTML directly although you can use it to fetch the HTML content of a page or an assignment.

You cannot create super-duper powerful HTML content and get it into Canvas using the API. The HTML you send is still sanitized and passed through the whitelist, just like if you had done it through the web interface.

What the API would allow you to do is to have an application that makes calls to Canvas on your behalf. It returns information in a computer-friendly format that your program can use. The web interface returns it in a human-friendly format so that people can use it.

People adding powerful HTML to their pages are generally either 1) adding custom JavaScript to their instance to support it or 2) hosting their content somewhere outside of Canvas and incorporating by embedding it or making it an LTI.

For instance, if you want to use accordions, you would add a library in your custom JavaScript that supports them and then you could add them to your pages. You could load Prism or some other source code formatting library and then computer science instructors could format their code fancifully just by adding some classes to the HTML that is inside Canvas.

Hosting it externally gives you full control over what goes on, but it is sandboxed when it comes into Canvas and it won't look or feel like Canvas unless you use the same CSS that Canvas uses. It cannot communicate directly with Canvas (for the most part) in the browser because of the iframe restrictions.

What your application could do is use the API to communicate with Canvas.