Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
I'm writing a course extension process and am stuck at this step. Currently the way we extend courses beyond course/term dates is through the GUI in this manner (luckily they are few and far between):
- create a new section in the course and assign the new end date to it
- check the box that limits student access
- navigate to the People course link
- find the student select the "kebob" (three dots) menu to "Edit Sections"
- select the new, available section in the search
- add teachers to the new section in the same manner
I've got everything configured to run this through the Canvas API, but cannot find an equivalent method to the "Edit Sections" in the GUI. Otherwise attempting to add an enrollment to a course that is beyond course/term dates results in an error:
{'message': "Can't add an enrollment to a concluded course."}
I could work around it by preparing an SIS upload file with the single enrollment, but am interested in keeping this integration out of the SIS processes and more accurately reflect the GUI activities.
Solved! Go to Solution.
I got this working by following this process:
I also got this "automated" using the script found here: https://github.com/reynlds-illinois/enterprise_learning_systems/blob/main/canvas/canvas_extend_cours...
I believe (with some evidence from the Dev Console) that the way that Edit Sections actually works is that it's calling an enrollment on the section and then (if needed) unenrolling from the deleted sections.
Are you potentially calling the Enrollment endpoint on the course ID instead of the section? If so, maybe switching to the section ID endpoint (like the one I linked above) will maybe work?
Here's what I did in the beta instance to see what endpoints Canvas was hitting:
1) Enrolled myself into a course, accepted invite, put myself in a section (Section 1) and created a new section (Section 2)
2) Go to the People page -> Edit Sections -> deleted section 1 and added myself to section 2, click update.
Here are the calls that I'm seeing in the Dev Console - It'll call the enrollment endpoint first, then unenroll (to ensure that you stay within the course properly).
Does this help?
Edit: somehow I'm having issues with inline images, for some reason? I'll attach the pictures with the calls.
I figured out what was going on. The "end date" for the section was malformed and not being set on the new section. The enrollment is successfully created now, but I see that the check box for "course_section[restrict_enrollments_to_section_dates]" is not being set even though I'm including it in parameters and is "null" when getting the specifics on the new section. Weird-o-rama...I guess I'll open a case on it since it appears "broken".
I got this working by following this process:
I also got this "automated" using the script found here: https://github.com/reynlds-illinois/enterprise_learning_systems/blob/main/canvas/canvas_extend_cours...
To participate in the Instructure Community, you need to sign up or log in:
Sign In