Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
According to the Calendar Events API it is not possible to retrieve calendar events for a specific course, can that really be true ?
It is possible to retrieve calendar events for a specific user:
So one would expect that there also was a way to retrieve calendar events for a specific course:
Use-case:
We need to synchronize calendar events per course from an external planning system into Canvas via the API, the events are often not on the same day of the week or time of day. The calendar events are planned ahead of any enrollments being made on the course, so it is not possible to use a random enrolled user on the specific course to retrieve the course calendar events as a work-around strategy.
Synchronization strategy:
Our initial strategy is to delete all calendar events (hence, we need to retrieve all calendar events for a course first) for a course and re-create them, every time there is a change on a course in the external planning system.
It is my understanding that the context_code[] parameter will supply the information about the course(s) you want to pull calendar events from.
Context code for a course would be something in the order of course_<course_id>, whereas a user calendar context code would be user_<userid>
Give that a try
It is correct that when calling "GET /api/v1/calendar_events" it is possible to supply context_code[] with course_<course_id> - but course_id is the internal canvas id, and it excludes us from using sis_course_id, which we can use with a course specific method ie. "GET /api/v1/courses/sis_course_id:myowncourse_id/calendar_events". We use sis_id's throughout all our API calls, as we prefer not to maintain or rely on a copy of the internal canvas id's.
It's another call's worth of overhead, but can you make a call using GET /api/v1/courses/sis_course_id:myowncourse_id, then use the Canvas course ID returned to make a call to the calendar_events endpoint?
To participate in the Instructure Community, you need to sign up or log in:
Sign In