cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Surveyor II

Passing Parameters to LTI Launch URL

Jump to solution

We built an application that is hosted on our private server. As of this point, we were able to embed the app using LTI and iframes. The next phase of our application is to dynamically changed the app content based on who's logged in and what course he/she is currently in.

The question is, is it possible to pass parameters (such as course id and student id) to the LTI Launch URL? Instead of "http://app.com/, it would be something like "http://app.com/?course=NNNNN&student=NNNNN" where both course and student values are predetermined by canvas.

That way, we could extract those values via a get parameter and pass it to our application before loading the app in the canvas.

Tags (3)
1 Solution

Accepted Solutions
Highlighted
Navigator

manuelgarciaph 

Look at the LTI Variable Substitutions documentation page.

When you add a custom field in the LTI configuration, it gets sent along with the API request.

  • Canvas.course.id will return the course ID
  • Canvas.user.id or user.id will return the user ID. If, for some reason, you need the global ID across all Canvas shards, there is also a Canvas.root_account.global_id and Canvas.user.globalId.

In the custom fields, the left side is the name you want to use and the right side is the variable substitution, prefaced with a $. For example: course.id=$Canvas.course.id

In the LTI launch request, the fields names (left side of assignment in the custom fields) are prefixed with custom_ and periods are changed to underscores: course.id would become custom_course_id.

View solution in original post

2 Replies
Highlighted
Navigator

manuelgarciaph 

Look at the LTI Variable Substitutions documentation page.

When you add a custom field in the LTI configuration, it gets sent along with the API request.

  • Canvas.course.id will return the course ID
  • Canvas.user.id or user.id will return the user ID. If, for some reason, you need the global ID across all Canvas shards, there is also a Canvas.root_account.global_id and Canvas.user.globalId.

In the custom fields, the left side is the name you want to use and the right side is the variable substitution, prefaced with a $. For example: course.id=$Canvas.course.id

In the LTI launch request, the fields names (left side of assignment in the custom fields) are prefixed with custom_ and periods are changed to underscores: course.id would become custom_course_id.

View solution in original post

Highlighted

Wow. That worked. Thank you so much, @James Jones.  You just made the day of 10000+ students!