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

Roster Information

What is the canvas-api route to get the roster information of particular course?

We assume following route is the correct one.
https://<canvas-install-url>/api/v1/courses/:course_id/enrollments 

If that is so,
At the moment we have saved the userId of particular user which comes thorough LTI launch. But above mentioned route returns different userId than that.
Is there a way that we can get lti userId with this route.
4 Replies
James
Navigator II

 @manprof2 ‌,

The user information available through the API will be the internal Canvas User ID and the SIS User ID, provided the account you're using has read permissions to access those IDs.

The information provided through LTI depends on the Privacy level specified.


With a Public level of privacy, you get the most information about the user from Canvas. This includes

  • custom_canvas_user_id: the internal Canvas User ID -- available through API
  • lis_person_sourcedid: the SIS User ID -- available through API
  • user_id: unique user ID used for LTI purposes. The Canvas source code refers to this as an opaque id, meaning it's designed to not convey any personal information about the user. I can't find the exact place in the source code where it's created, but it could be a hash of the Canvas User Id, possibly with a salt or message digest.This is not available through any API that I'm aware of.

If you select anything less than Public level of privacy (anonymous, email only, name only), then you won't get the first two, just the user_id.

If you want to get the Canvas ID or SIS ID for a user, make sure you've set the LTI privacy to Public when you install the external tool in Canvas and then that information will be sent as part of the request.  If you want to take that LTI user_id and work backwards to something else, I think you're out of luck.

manprof2
Community Member

It would be great if you can confirm, following route is the only route which we can get roster information of particular course.

https://<canvas-install-url>/api/v1/courses/:course_id/enrollments 

Apart from that is there any route available to take LTI user id by passing the canvas user id.
James
Navigator II

Breaking news tonight ... Canvas Beta Release Notes (2017-02-06) 

The LTI user_id is getting added to the Get User Profile API endpoint [note that links to the beta documentation since it's not in production yet]. It's what you asked about in your second message from Feb 3 that I just now saw.

There does not appear to be a way to do a reverse search on the LTI user_id to find out the user that goes with it, but then allowing that might be a privacy risk because if the user wanted the LTI to have their information, they could have just specified public for the privacy level to start with.

The endpoint you gave in that message is not the only way to get enrollments for a course.

There may be others.

chofer
Community Coach
Community Coach

Hi  @manprof2 ‌...

I thought I would check in with you because there hasn't been any new activity in this particular discussion topic since  @James ‌' last response on February 6th.  It looks like he's given you some good help here so far.  Did the responses from James help to answer your question?  Are there any outstanding questions you have about your question?  If you want, please mark one of James' responses as "Correct" if you feel that it answers your question.  But, if you are still seeking assistance, please post a message so that members of the Community can continue to help you troubleshoot.  For now, I am going to mark your question as "Assumed Answered", but that won't prevent you or others from posting additional replies below.  I hope this is okay with you.  Looking forward to hearing back from you.