Gerald Q. Maguire

Removing users and assignments via the API

Blog Post created by Gerald Q. Maguire on Jun 29, 2018

My recent attempt to migrate users' grades for assignments from a pre-Canvas course to Canvas starts by adding the users to a Canvas course, then adding the assignments, and then finally adding each student's grade for each assignment.

 

Of course such a program requires testing. This testing creates lots of enrollments for users. In order to run the program again it is very convenient to remove these users. Similarly there is a need to remove the created assignments. Hence I wrote two scripts:  (1) to remove users (except for myself) and (2) to remove all assignments.

 

You can find the code for them at Removing other users and assignments: Chip sandbox .

 

One of the small gotchas that I found is that to remove a user from enrollment in a course you need to use the user's enrollment_id and not their canvas_id.

Outcomes