API Call to Change Course Role to Custom or to Delete and Re-Add Student Enrollment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Administrators at our high school want to be able to turn off messaging for just certain students. I can do this by manually deleting their current "Student" enrollments and adding them back to their classes as our custom course user role "Restricted Student" for whom we have taken away permissions for messaging.
But the nightly sync with our SIS (PowerSchool via SIF to Kimono) reverts these changes.
So I need to automate this to run each night. I found a way with 2 CSV uploads called by cURL via the API.
This is cool and very powerful since I can do everything the CSV uploads can, but seems like overkill.
Is there an API call that would let me make the changes without the CSV?
What I imagine is that my SIS could crank out a nightly file of students marked to restrict, then a python script reads the entries on that file (course section and student) and either:
1. Changes the course role like we can in the UI (is there an API call for this - like a PUT for the roleid? This is not in the LiveAPI, but are there some that are not?),
or
2. (like my CSVs) deltes the SIS-created "Student" enrollment and and re-adds the student as our custom "Restricted Student" (I know that there are API calls for these, but I do not know how to use my SIS-generated information (canvas sectionid and canavs userid) to do this - the delete call in the API appears to need canvas course id - since we have many cross-listings, this might not be possible - will i have to make and parse a first call to get the users courseIDs?
thanks for any thoughts on this. i have just been telling them "not possible" for several years, but now that I can leverage the API, it is - just want to do it efficiently.