Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
Hi All,
I need to delete enrollments with the following conditions:
I look at this Enrollments - Canvas LMS REST API Documentation but requires enrollment id and using a course endpoint.
Is there any way to perform this task or SIS import is the only option?
Yes, if you also have the sis course id, you can do it with two calls. The first to get the enrolment id, and the second to do the delete.
For example, something like:
/api/v1/sections/sis_section_id:MySecId/enrollments?sis_user_id=MySISId
Get the id from the returned JSON, and then
/api/v1/courses/sis_course_id:MyCourseId/enrollments/:id
Note that you can use things like sis_section_id:SectionId where you need an object's id (Object IDs, SIS IDs, and special IDs - Canvas LMS REST API Documentation).
And if you do not have the course sis id, you can call:
/api/v1/sections/sis_section_id:MySecId
To get the course id (and also the course sis id).
Hi Peter,
Thanks, I was able to perform the task in two calls. The first call response also provided me the course id, so I dont need to do a third call.
One thing I noticed is that even though I am passing task=delete parameter to the second call, the final result is that user enrollment sits under Completed Enrollments instead of being deleted from the section/course. I am not a UI user entirely, but is this the normal behavior on Canvas?
Um, not sure where Completed Enrolments shows up (I'm not a major UI user either).
If I do a task=delete the enrolment appears to disappear from everywhere I've looked.
If I do not do the task=delete, the enrolment disappears from the course's People, but shows to the user under Past Enrolments.
To participate in the Instructure Community, you need to sign up or log in:
Sign In