cancel
Showing results for 
Search instead for 
Did you mean: 
sutaria
Community Participant

Passing data from Canvas to External tool (LTI)

Jump to solution

I am very new to LTI. I followed  @garth 's tutorial (part1) to generate XML and add it in Canvas to see my tool show up.

I tried to follow the part2 of his tutorial and I am a bit lost. From what I read, Canvas makes a POST to my tool with some information. I need to parse out the UserId and CourseId from that POST.

I dont know how to access this POST response. Does anybody has .Net code that can help me with this? 

Thank you in advance.

Tags (2)
1 Solution

Accepted Solutions
garth
Community Champion

 @sutaria ‌ the sample code is written in .NET, specifically in C#.

It might be worth downloading the source and stepping through it with the articles.

Here is a post I did on helpful LTI tools:  LTI 1.x - Useful Links 

I recommend looking at the Canvas course:  Canvas Dev and Friends 

Working through this course will help you get up to speed on how to handle API calls and results.

If you are able to successfully launch your web app through Canvas, place a break point in the method that Canvas is calling and inspect the Request object.  You should be able to inspect the Request object and see values similar to the screen shot.as shown in the post .NET LTI Project - Part 2 - Launch Request 

 I hope this helps.

View solution in original post

5 Replies
garth
Community Champion

 @sutaria ‌ the sample code is written in .NET, specifically in C#.

It might be worth downloading the source and stepping through it with the articles.

Here is a post I did on helpful LTI tools:  LTI 1.x - Useful Links 

I recommend looking at the Canvas course:  Canvas Dev and Friends 

Working through this course will help you get up to speed on how to handle API calls and results.

If you are able to successfully launch your web app through Canvas, place a break point in the method that Canvas is calling and inspect the Request object.  You should be able to inspect the Request object and see values similar to the screen shot.as shown in the post .NET LTI Project - Part 2 - Launch Request 

 I hope this helps.

View solution in original post

sutaria
Community Participant

Thank you very much for the response, I will do what you suggested.

bro16111
Community Participant

Install the LtiLibrary.AspNetCore Nuget package by andyfmiller. With the library you can parse out the LtiRequest. On the post method or wherever your endpoint is, you can do:

var ltiRequest = await Request.ParseLtiRequestAsync();

You will then have access to all the properties that come in with the request.

sutaria
Community Participant

 @garth ‌ Thank you for the pointers, I was able to get the params from the POST successfully.

sutaria
Community Participant

I was able to extract the data I wanted from the POST method. Thank you very much