Create LTI Submission with API

Jump to solution
peter3
Community Member


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
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