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

Create LTI Submission with API

Jump to solution


So I have an LTI tool, and I want to be able to send back assignment submissions that have an LTI launch that will bring the speedgrader directly into the submission.  Looking at the api docs it would seem that this is possible because it accepts a submission_type of basic_lti_launch

curl https://<canvas_url>/api/v1/sections/27/assignments/253/submissions       -F 'submission[submission_type]=basic_lti_launch'       -F 'submission[url]=http://localhost:8080/ltilaunch/info'       -H 'Authorization: Bearer GFn...ZXLo'

However when I call that it responds with:

{"status":"unauthorized","errors":[{"message":"user not authorized to perform that action"}]}

I know that I have access to submit an assignment using my auth token because if I change the assignment to accept a url submission and then alter my curl to be type=online_url  it accepts it.

Is there a trick or something that I am missing in the doc about sending a basic_lti_launch as an assignment submission?

Labels (2)
1 Solution

Accepted Solutions
peter3
Community Member

OK so the answer that is working is to use the LTI Homework Submission Tools but to make one change instead of passing in a <url></url>  pass in an <ltiLaunchUrl> tag instead

this appears to be a new feature that was committed to the repo in late June '16.  Here are the commits

https://github.com/instructure/canvas-lms/commit/8ed5e1d0f5b5a515d82a371dc8269ff82324ffcb

https://github.com/instructure/canvas-lms/commit/e7229f0fc8a2e986e82e06c734274d8157d92b75

This is an example of the IMSPOXRequest that is being sent back to canvas.

<?xml version="1.0" encoding="UTF-8"?>

<imsx_POXEnvelopeRequest xmlns="http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0">

  <imsx_POXHeader>

  <imsx_POXRequestHeaderInfo>

  <imsx_version>V1.0</imsx_version>

  <imsx_messageIdentifier>999999123</imsx_messageIdentifier>

  </imsx_POXRequestHeaderInfo>

  </imsx_POXHeader>

  <imsx_POXBody>

  <replaceResultRequest>

  <resultRecord>

  <sourcedGUID>

  <sourcedId>#{@lis_result_sourcedid}</sourcedId>

  </sourcedGUID>

  <result>

  <resultData>

  <ltiLaunchUrl>https://your.launch.url</ltiLaunchUrl>

  </resultData>

  </result>

  </resultRecord>

  </replaceResultRequest>

  </imsx_POXBody>

</imsx_POXEnvelopeRequest>


					
				
			
			
				
			
			
				
			
			
				

View solution in original post

7 Replies
garth
Surveyor II

For an LTI assignment, you will be using the Outcomes Service to post grades back to the gradebook, not the API.

You should receive two variables on the launch request of your assignment:

- lis_outcome_service_url - this is the callback to Canvas to post the grade for the assignment

- lis_result_sourcedid - this is the reference to the specific cell in the gradebook representing the exact assignment and exact student associated with the grade you are posting.

To quote the IMS document:

"The TP may retain thelis_outcome_service_url and lis_result_sourcedid from a launch and then call the service long after the user's session has ended."

The intention of these two variables is to allow the student to complete the assignment and leave, if the assignment requires additional processing by the Tool Provider, the Tool Provider is able to post the grade once the processing is complete.

Take a look at the IMS doc, see if this helps:

Learning Tools Interoperability v1.1 Implementation Guide - LTI Basic Outcomes Service

peter3
Community Member

I am not trying to supply and outcome, I am trying to supply a 'submission' back (see Submissions - Canvas LMS REST API Documentation )  so that an instructor can manually grade the assignment via the speed grader.

At present it would seem like the post call with type=basic_lti_launch is not working.

Ahhhh, sorry I misunderstood.

I'll do some testing and see if I can reproduce this.

Looking into this further, there is a method of making a submission from an LTI assignment.

Take a look at this document:

Homework Submission Tools - Canvas LMS REST API Documentation

To quote the doc: "This extension adds the following parameters to the LTI launch event"

So it looks like you will need to update the XML definition of the <lticm:options name="homework_submission">

I looked at this some time ago, but have not practiced it.  The custom assignments I have created post grades back, I will need to work through posting a submission back before I can outline exact steps.

I am not sure I'll have time this evening, but I'll post steps as soon as I have completed testing.

If you get there first, please share.

 @peter3 ​, just following up.  I looked at this last night, and the Homework Submission Tools​ documentation doesn't seem to be complete.  So far I am unable to reproduce the expected behavior defined: "When a tool is configured, users will see an additional tab during assignment submission "

Let me know if you discover anything.

Thanks for asking this question, it's a good puzzle.

peter3
Community Member

OK so the answer that is working is to use the LTI Homework Submission Tools but to make one change instead of passing in a <url></url>  pass in an <ltiLaunchUrl> tag instead

this appears to be a new feature that was committed to the repo in late June '16.  Here are the commits

https://github.com/instructure/canvas-lms/commit/8ed5e1d0f5b5a515d82a371dc8269ff82324ffcb

https://github.com/instructure/canvas-lms/commit/e7229f0fc8a2e986e82e06c734274d8157d92b75

This is an example of the IMSPOXRequest that is being sent back to canvas.

<?xml version="1.0" encoding="UTF-8"?>

<imsx_POXEnvelopeRequest xmlns="http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0">

  <imsx_POXHeader>

  <imsx_POXRequestHeaderInfo>

  <imsx_version>V1.0</imsx_version>

  <imsx_messageIdentifier>999999123</imsx_messageIdentifier>

  </imsx_POXRequestHeaderInfo>

  </imsx_POXHeader>

  <imsx_POXBody>

  <replaceResultRequest>

  <resultRecord>

  <sourcedGUID>

  <sourcedId>#{@lis_result_sourcedid}</sourcedId>

  </sourcedGUID>

  <result>

  <resultData>

  <ltiLaunchUrl>https://your.launch.url</ltiLaunchUrl>

  </resultData>

  </result>

  </resultRecord>

  </replaceResultRequest>

  </imsx_POXBody>

</imsx_POXEnvelopeRequest>


					
				
			
			
				
			
			
				
			
			
				

View solution in original post

Sweet, thanks for posting this, this is a huge help.

Thanks again for asking the question.