mpeterso
Community Member

Not able to "Undelete" course using rest api endpoint

Hello all,

we are using PUT /v1/courses/{id} api endpoint to delete and undelete a course. but when we call the api with json

{"course":{"event":"undelete"}}

it gives 401(Unauthorized error).  It is working fine before. Anyone know the workaround or any solution

mpeterso_0-1625128107405.png

 

Labels (1)
0 Kudos
2 Replies
chriscas
Community Coach
Community Coach

Hi @mpeterso,

I'm going to guess this happened because of the more granular permissions around course management that were included in the June Canvas release.  For the account role your API user has, can you check out the account permissions and make sure all of the required ones are enabled (courses - undelete, course content - view and manage courses - delete), as outlined in the screenshot from the undelete permission here:

Screen Shot 2021-07-01 at 8.38.21 AM.png

-Chris

mpeterso
Community Member

Thanks @chriscas  for the quick response. I have already checked and this permission doesn't are in consideration while we use rest api. I talked to canvas support as well. They replied, we are seeing a 401 error when trying to restore a course using the API. The 401 being seen will occur when a course has a SIS ID. When a course has a SIS ID, there are implicit assumption in Canvas that the course is managed by SIS (i.e. CSV uploads). As part of this, deleted courses with a SIS ID are intentionally disallowed from being updated via API. This is why 401 errors are being returned in this circumstance.

0 Kudos