Skip navigation
All Places > Canvas Admins > Blog > 2019 > June
2019

I love it when asking a question prompts me to think about and reasearch the actual answer; since I had already typed most of this posting when the solution came to me, I decided to complete it anyway. The topic above is answered herewithin!

 

When managing user enrollment using the API, I have scripts set up to deal with student "adds" and "deletes/withdrawls" by our SIS. These work well until you bring crosslisted sections into the picture.

 

Active Enrollment Endpoint: POST /api/v1/sections/:section_id/enrollments
This endpoint works for crosslisted sections because it is based on the Section_ID which is associated with another Course_ID in the crosslist process.

 

Ended Enrollment Endpoint: DELETE /api/v1/courses/:course_id/enrollments/:id

For crosslisted sections, this endpoint fails because the section in which the student is enrolled is no longer tied to its original Course_ID. Indeed, the course still exists, but the student isn't currently enrolled in that course, thereby failing the API call because "The specified resource does not exist."

 

Solution:
There is an API endpoint where I can use a Section_ID to determine its associated Course_ID. For all enrollment deletes, use this endpoint, first, to determine the correct course from which to actually delete the enrollment, then use the endpoint above to delete the enrollment.

 

Section Information Endpoint: GET /api/v1/sections/:id
The base response from this endpoint provides the course_id and sis_course_id of the course with which it is associated. Use either of these in the DELETE endpoint above

I had a situation this morning when I needed to "act as" a student in a course via the Canvas Student app. I knew the "Act as User" functionality was there but I never had an opportunity to try it out.

 

I decided to make a Canvas admin guide on how to use it and share it in the community.

 

Use 'Act as User' in Canvas Mobile App

 

Feel free to share with others if it's useful!

 

Act as user on Canvas mobile app

Filter Blog

By date: By tag: