To Our Amazing Educators Everywhere,
Happy Teacher Appreciation Week!
Found this content helpful? Log in or sign up to leave a like!
"During the LTI launch, I am receiving the following parameters:
The user_id is in this format: "9dfd5a225d8c9dacba7302c095df431b5e40fb63," which I initially saved in the database. Is there any API call in Canvas or any other method to retrieve the canvas_id or sis_user_id using this user_id?"
Solved! Go to Solution.
The user_id in an LTI launch can be looked up by using the special prefixed as outlined in: https://canvas.instructure.com/doc/api/file.object_ids.html
If you're getting the ID through a LTI 1.1 launch then you can use a prefix of 'lti_1_1_id:' so to lookup the user_id from your example you'd make an API request (with an token) to https://inst.instructure.com/api/v1/users/lti_1_1_id:9dfd5a225d8c9dacba7302c095df431b5e40fb63 and it should return details of the user.
NB: This doesn't work for everyone, if someone access your Canvas instance who you can't view details of it will fail, an example of this is Instructure Support when they access a tool. They can access your instance, but a token that you use to lookup details won't find anything. But these users are very rare in most cases.
The user_id in an LTI launch can be looked up by using the special prefixed as outlined in: https://canvas.instructure.com/doc/api/file.object_ids.html
If you're getting the ID through a LTI 1.1 launch then you can use a prefix of 'lti_1_1_id:' so to lookup the user_id from your example you'd make an API request (with an token) to https://inst.instructure.com/api/v1/users/lti_1_1_id:9dfd5a225d8c9dacba7302c095df431b5e40fb63 and it should return details of the user.
NB: This doesn't work for everyone, if someone access your Canvas instance who you can't view details of it will fail, an example of this is Instructure Support when they access a tool. They can access your instance, but a token that you use to lookup details won't find anything. But these users are very rare in most cases.
Thank you, Matthew. It worked for me.
To participate in the Instructure Community, you need to sign up or log in:
Sign In