404 error for deactivating an enrollment.

Jump to solution
rancho
Community Member

I am sure this is something easy, but I can not see it.  I want to deactivate an enrollment in a class.  I am looking at this documentation.

DELETE /api/v1/courses/:course_id/enrollments/:id

Scope: url:DELETE|/api/v1/courses/:course_id/enrollments/:id

Conclude, deactivate, or delete an enrollment. If the task argument isn't given, the enrollment will be concluded.

Request Parameters:

Parameter   Type Description
task   string

The action to take on the enrollment.

 

I am using this url and sending as a HTTP DELETE


 

https://XXX/api/v1/courses/44727/enrollments/29569?task=deactivate 

 

the documentation said the task parameter was optional and would default to concluded.  So I tried that as well, and still received the 404.

Thanks bob

0 Likes
1 Solution
matthew_buckett
Community Contributor

The 404 means it can't find something. Where did you get the enrolment ID from? the enrolment ID is different from the user ID so if you are trying to conclude an enrolment for a user, you first have to find out the enrolment ID for the user ID.

Depending on what you are wanting to do there are various ways to find enrolment IDs: https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.index

If you are doing bulk updates I would recommend using a provisioning report and a SIS Import, rather than making lots of API calls. It will be faster, but also is easier to test and revert/recover if something does wrong. SIS Imports also have a log of all the changes that have been run which can make debugging problems much easier.

View solution in original post

0 Likes