Getting List of Calendar Events

Jump to solution
aineshchat
Community Member

I am a student. I am trying to build a tool that optimizes a student's work schedule. For that, I need to pull a student's calendar events. However, I could not find a python API wrapper implementation for this, so I tried to use requests to get the data. Unlike courses data, the base URL 

https://mcpsmd.instructure.com/api/v1/calendar_events

just has a blank array [], instead of containing all of the calendar events and their data

However, when I add a specific event URL ending to it, such as

https://mcpsmd.instructure.com/api/v1/calendar_events/2031343

The data for that event is all there.

So, I decided to try and use json requests to get calendar events by course id:

https://mcpsmd.instructure.com/api/v1/calendar_events?context_code=course_550679

This simply results in an error:

{'errors': [{'message': 'The specified resource does not exist.'}]}

So, I thought to try searching by ID since I knew the event with id 2031343 exists, but that didn't work either:

https://mcpsmd.instructure.com/api/v1/calendar_events?id=2031343

 

How do I get a list of calendar events? Either a JSON request implementation or python implementation is fine. Thanks!

Also, just to clarify, I have either been testing these URLs directly (so OAuth cookies were present) or through JSON requests with a valid Authorization Bearer token), so that is not the issue.

Additionally, I am able to successfully use JSON requests for course data so my access level as a student is not the issue either.

Labels (5)
0 Likes
1 Solution
werner_huysman1
Community Participant

Hi,

the format is https://xxx.instructure.com/api/v1/calendar_events?context_codes[]=course_123. If you want to catch assignments, you have to provide the type-parameter, since the type defaults to event. 

View solution in original post