Canvas API: Enrolling students into course (query user ID/SIS ID)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using Canvas Free for Teachers. How can I enroll a student into my course programmatically using the Canvas API? I have the student's email address. The problem is that the student may or may not have a pre-existing Canvas account.
Assuming students do not have a Canvas Account, I (1) Create the user. This returns their ID, so I (2) Enroll the user. This works! However, some students already have a Canvas account, and Canvas API returns fail upon trying to create the user, and I cannot retrieve their ID and therefore am unable to enroll the user into my course.
> Is there a way to query a user's ID given their email address so I can enroll students? Or there may be a better approach to enrollment altogether. Alternatively, it seems this may be possible if I can query a user's SIS ID.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Augustine,
In most cases where you would load a user by canvas id you can substitute in sis_user_id:<user_sis_id>. So it would look like this, if the user name is jsample:
/users/sis_user_id:jsample/profile
That gets you the user's profile which includes the canvas id.
I'm unaware of any pure api way to do this with an email address. I do most of my lookups via sis_user_id.