[ARCHIVED] Need Assistance with Canvas COMMONS API: Create Session

Choachy
Community Participant

Canvas Admin here... I'm average at best with the Canvas API endpoints. We have about a dozen tasks I've created for us that utilize the API, and I can usually do what I need to do.

I've never tried to use the Canvas Commons API before, but I have a need for it now and I cannot even get over the first hurdle of creating a session to get the sessionID. 

Can someone who has gotten this to work, please share the code they use to get a sessionID for the Canvas Commons API?

  1. I'm using the documentation here: https://lor.instructure.com/docs/api/#api-Session-CreateSession
  2. I'm first going to https://[our-canvas-domain]/api/lti/accounts/self/jwt_token?tool_launch_url=https://lor.instructure.com/api/lti and getting a  jwt_token without a problem.
    1. The token I get is around a 3,500 character string, which I assume is good.
  3. I then run the example from the doc:
    curl -X POST -H "Content-Type: application/json" --data '{"jwt_token": "blahblahtokentokentokentoken"}' "https://lor.instructure.com/api/sessions"

I get 2 errors returned:
Unmatched closed brace/bracket in column 3622
{"errors":[{"param":"server-error","msg":"There was an error"}]}

I'm pretty sure the brace/brackets are correct. Aren't they? 

I've also trying including the access bearer token, but that doesn't seem to make a difference. Do I need this in there?

If I can just see an example of how to get the student sessionID response, I can take it from there.

Labels (2)
0 Likes