I'm looking to enroll students in a course using the REST API, but in order to use the API I need to know the Canvas User ID. From the Enrollment API documentation for enrolling a user:
where a sample CURL request would be
curl https://<canvas>/api/v1/courses/:course_id/enrollments \
-X POST \
-F 'enrollment[user_id]=1' \
-F 'enrollment[type]=StudentEnrollment' \
-F 'enrollment[enrollment_state]=active' \
-F 'enrollment[course_section_id]=1' \
-F 'enrollment[limit_privileges_to_course_section]=true' \
I unfortunately don't have the user_id to POST. I have the SIS ID or the Login ID, but not the user_id. The web interface allows me to add people to a course by specifying a SIS or Login ID, but that doesn't not appear to be the case with the enrollment API.
I tried passing enrollment[sis_user_id] and enrollment[sis_id], but that didn't work. I then searched the codebase and see that the enrollments api controller requires the existence of the user_id.
Is there a way to get the user id of a user given a particular SIS or login ID?