cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
yaach
Community Member

Deleting sections enrollments with user sis ids

Hi All,

I need to delete enrollments with the following conditions:

  • Enrollments need to be deleted from a section with sis id.
  • Enrollments need to be deleted using a user sis id

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?

Labels (5)
0 Kudos
4 Replies
pklove
Community Champion

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).

pklove
Community Champion

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).

yaach
Community Member

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?

pklove
Community Champion

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.