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

All things API

Have a question about the Canvas APIs? Have a cool API integration you'd be willing to share? If so, please post here.

Labels (1)
Tags (1)
271 Replies

Interesting, thank you. It certainly seems like an LTI application is the way to go. I'm new to the concept of LTIs, and I've been reading on them here: Edu App Center - Basics - Introduction . But I'm interested in getting started on them ASAP.

If using the PHP Laravel framework, do you have any suggestions on how to get started making an LTI app for Canvas?

Check out the code at GitHub - ucfopen/lti-template-php 

Gerald, thank you for that that library, it and the other ones seem very convenient. I'm able to get other libraries like "XML to Array" and "XML Collection" installed.

However, despite having Composer, I'm not able to run some of the key commands? 

"php composer.phar install"

doesn't seem to work, unfortunately, and just says "could not open input file: composer.phar"

In addition, I'm testing on my local machine at the moment, meaning I don't have any Canvas functionality (or so I'm guessing, still new to Canvas still). How might you suggest I test that some LTI applications, like the extensions from Edu App Center, are working?

I built a version of Canvas according to the github Quick Start instructions: Quick Start · instructure/canvas-lms Wiki · GitHub 

This enables me to have Canvas (at home and in my office) running as a set of containers. I have built it in a VM, so that I can easily give a copy of a system that is ready to run and configured suitable for development - to students who are working with me on Canvas related developments. I have built the VM using VirtualBox. There are several advantages to such a system: (1) if one screws up - you can easily return to a checkpoint; (2) you have all the privileges that you could want; (3) you can see everything - even the details in the database; and (4) since the source code is used to build the system you know just want is running and can explore what each part of the code does. However, there are some disadvantages: (1) it is not necessarily easly to get everything working (due to lots of dependencies); (2) starting up a new system takes a lot of time [but you can snapshot this running system and thus continuing to work with it is not so bad]; (3) sometimes - you would rather not know all of the details; and (4) as it is not the supported production system there may be differences between what you see in this local system and what you experience in the supported cloud version of the service.

I have never worried much about the XML files to set up the LTI tool, as I wrote python code to deal with most of this via the Canvas API. Note, that  I am not supporting production LTI tools, but rather focusing on proof of concept implementations. [Thus I have left these sorts of details to the professional staff - as they will have to support the tools that the university decides to support. All I can do (presently) is to show the feasibility of doing something. If it gets adopted, then the professional staff take it over and make a production tool.]

I have a variety of LTI applications written in Ruby that you can find at GitHub - gqmaguirejr/E-learning: E-learning project for using Canvas 

Interesting, thank you. Looking at your code, I'd just like to confirm: it seems like your apps are made via requesting canvas page data, and making your own page based around that. Is that a fair summary of it? Sorry if that seems like a silly question, I'm under the weather and not very savvy with Ruby

Adventurer II

When you call an external tool via the LTI interface you can invoke your own program (which acts as an LTI Tool Provider). The output from this program will generally appear in an iframe within the Canvas interface. Your output will not have access to the webpage outside of the iframe (as is consistent with modern web security). The Canvas LMS acts as a Tool Consumer (i.e., gets data from the tool).

In many uses of LTI the tool is used to provide an external quiz engine, content, etc. You can decide how much information to pass into this external tool. For example, this means that the external tool need not know the user's actual ID, name, etc. The external tool can check that it is called from Canvas. The external tool can return a grade for an assignment, where the external tool implements the assignment. An earlier Master's project used this functionality to provide the student with a preconfigured virtual lab environment in which the student does there lab exercise and when the student has completed the exercise returns the grade to Canvas. See the Master's thesis: On-demand virtual laboratory environments for Internetworking e-learning : A first step using docker...  .

However, in my programs, the external program has an access token that it uses to get essentially any data that it wants out of the Canvas LMS. I make use of this to access user information, store and retrieve data from custom columns in the grade book, ... . For example, one of the programs gets documents that have been submitted for an assignment - extracts the title, English and Swedish abstracts, English and Swedish keywords, and other data and uses this together with information about the student to create an announcement for the student's oral presentation of their thesis. This means that the examiner scheduling the oral presentation does not need to manually extract this information from the document, but rather can have a program do this work. The examiner sets the time, date, and place of the examiner and assigns an opponent (i.e., another student who will do a peer review - both written and orally) and the program composes an announcement for the presentation. This announcement is posted as an announcement in the Canvas course and also can be placed into the university's calendar (this last functionality is not available yet - as the people responsible for the API to the calendar have not yet introduced the functionality for 1st and 2nd cycle presentation, but does support 3rd cycle presentations, i.e., doctoral-level defenses). Similarly, after the student's final thesis is submitted and approved by the examiner, the goal is to automatically enter the metadata about this thesis and enter it into the digital repository and upload the thesis itself into this repository. [The external reference (URL) to the thesis above - shows what a thesis looks like in this digital repository.]

So, if I understand you correctly, yes? That's essentially how I've done it: make cURL requests from endpoints using headers and tokens, decode the data and then perform operations based on that.

There are really two orthogonal parts to this:

1. using the LTI interface to invoke from Canvas an external LTI Tool and

2. using the Canvas API to access the Canvas endpoints.

These two things can be combined as I have done with my programs. Additionally, there are two other methods of passing data from Canvas to the LTI tool:

a. You can pass values into the tool when it is invoked and

b. Using the IMS Global Learning Consortium Learning Information Services (LIS) specification

    (Note that the LTI Basic Outcomes Service is a LIS service that can be used to pass grading information from the tool back to Canvas.)

Not surprisingly one of the pieces of information that is passed from Canvas to the tool is how to invoke the LIS services.

You can find some more background about this in the Master's thesis that I mentioned in my previous posting.

Using the Canvas API you can easily make programs that can get/put information from/to Canvas. These programs can be run on any machine that can communicate with the Canvas instance.

This is in contrast to the LTI interface, where you have to install the LTI tool as an external App in the Canvas instance. Within my university you need to get each LTI tool approved before you can get it installed. These approvals are per course or per school within the university - with a very small set of tools approved for use by some category of users (typically teachers) throughout the university (for example, we have a beta release of a locally created service to post grades from Canvas to the national grade repository). Also the LTI tools run on some machine other than the machine where the Canvas instance is and other than the machine were the user is who invokes the LTI tool. [However, for development purposes I do have both the Canvas LMS instance running in containers on the same machine where I have the LTI tool running - but this is unlikely to scale well.]

Community Member

So I want to use Laravel Passport authentication on my Canvas test server. I'm reading right now through the documentation here:
I want to apply this part to Canvas so I can parse the JSON it gets here. Looking at the "JSON API" header, shortly under the linked section, is where I find my problem:
"However, you will need to pair Passport's JSON API with your own frontend to provide a dashboard for your users to manage their clients."
It then gives an example for getting users and data in the Axios API. But I want to be able to get Canvas-related data. For example, "GET /oauth/clients" is cited as a way to return all the clients for the authenticated users. How can I do exactly that in Canvas?

Have you looked at and gives some basics of writing an LTI tool provider and gives a PHP example. The page also provides some helpful information on the POST parameters that are passed from the consumer (in this case Canvas) to your tool provider (Lavarel).