Error 422 on LTI Advantage grade passback

Jump to solution
chuck_wight
Community Novice

I have an IMS LTI Advantage certified app (ChemVantage) that I'm trying to configure to submit scores to Canvas using the Assignment and Grade Services v2.0. I keep getting an HttpResponseStatus 422 (Unprocessable Entity) and could use a little help, please.

Details:

Created the assignment in Canvas using DeepLinking workflow OK.

Test student LtiResourceRequest launch OK. Includes resourceLinkId, lineitem URL and scores scope.

When ChemVantage is ready to submit the score to Canvas it requests and receives a valid auth token

Then ChemVantage tries to POST the test student's score:

POST https://salisbury.instructure.com/api/lti/courses/38462/line_items/12/scores
Content-Type: application/vnd.ims.lis.v1.score+json
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2NhbnZhcy5pbnN0cnVjdHVyZS5jb20iLCJzdWIiOiIzMjU3MDAwMDAwMDAwMDA0NCIsImF1ZCI6Imh0dHBzOi8vY2FudmFzLmluc3RydWN0dXJlLmNvbS9sb2dpbi9vYXV0aDIvdG9rZW4iLCJpYXQiOjE1OTA5MzAwNTgsImV4cCI6MTU5MDkzMzY1OCwianRpIjoiNmE5OTAyOTctMDBmZC00YWZlLWE3ZTMtYTc2ODhiM2E3MDNkIiwic2NvcGVzIjoiaHR0cHM6Ly9wdXJsLmltc2dsb2JhbC5vcmcvc3BlYy9sdGktYWdzL3Njb3BlL3Njb3JlIn0.Z1IY1Uo6eq8rip7ZadKAfsg05jedB4u_sUQKfBeTsSc


{"timestamp":"2020-05-31T13:00:58.255Z","scoreGiven":10,"scoreMaximum":10,"comment":"Number of attempts=11","activityProgress":"Completed","gradingProgress":"FullyGraded","userId":"a1c7f3ad-0648-4009-a03e-0a08e2ba6bca"}


But after writing the JSON to the output stream, the connection status is
Status: 422 Unprocessable Entity
Transfer-Encoding: chunked
null: HTTP/1.1 422 Unprocessable Entity
X-Request-Processor: 00f51242fa5667c8f
X-Request-Context-Id: b28ab049-4ecc-48a7-beed-daed65933f93
Server: Apache
X-Content-Type-Options: nosniff
X-Runtime: 0.120072
X-Request-Cost: 0.11429672700046467
Connection: keep-alive
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
P3P: CP="None, see http://www.instructure.com/privacy-policy"
Date: Sun, 31 May 2020 13:00:58 GMT
Cache-Control: no-cache
X-Rate-Limit-Remaining: 700.0
X-Canvas-Meta: q=701;a=1;g=MnuNKqUKrVdWDEHodbsGkQUJD1owW09oVDb0fI3V;s=3257;c=cluster26;z=us-east-1c;b=2653152;m=2653152;u=0.10;y=0.00;d=0.01;
Vary: Accept-Encoding
X-XSS-Protection: 1; mode=block
X-A11y-Ally: Dana Danger Grey
Content-Type: application/json; charset=utf-8

Canvas didn't seem to like the Content-Type, although this is required by the LTI AGS specifications. I tried sending the POST with Content-type application/json but I got the same result.

If anyone has an idea of how I can take the next step, please let me know!

    

Not Logged in

1 Solution
jstoecker2
Community Novice

I also ran into a few different 422 errors and have finally resolved them.

Canvas will respond with an html 422 if you try to post scores to the line_item.url (rather than the correct line_item.url + "/scores" endpoint)

Once you are posting to the correct endpoint, you will get a 422 with "User not found in course or is not a student" if your LTI Developer key is set to private. Canvas sends a dummy lti user id (the "subject" claim) until you set your LTI Developer key privacy level as public.

So, after getting a bearer token via a client_credentials grant, and posting this to /scores:

{"timestamp":"2020-09-30T05:38:12.151Z","scoreGiven":0.1,"scoreMaximum":1,"activityProgress":"InProgress","gradingProgress":"FullyGraded","userId":"14ddf77c-4ae7-46cf-9698-e2788a192e6d"}

I am able to get grade passback working.

View solution in original post

0 Likes