get_calendar_events returns an empty object #615
Replies: 3 comments 2 replies
-
Hey @bbeck6, I would either call |
Beta Was this translation helpful? Give feedback.
-
You need to use the `context_codes` argument and then pass it course values like this:
`canvas.get_calendar_events(context_codes=["course_12345"])`.
You can pass up to ten contexts per request, so you can get multiple courses or multiple users all at once. The context code format is `resource_id` for courses, users, or groups.
[API docs](https://canvas.instructure.com/doc/api/calendar_events.html#method.calendar_events_api.index)
|
Beta Was this translation helpful? Give feedback.
-
Sorry, make sure you context codes are in quotes - it expects a string.
On Fri, Apr 28, 2023, 4:08 PM Brian Bennett ***@***.***>
wrote:
… I'm on my phone, so please excuse any bad formatting. You need to use the
`context_codes` argument and then pass it course values like this:
`canvas.get_calendar_events(context_codes=[course_12345])`.
You can pass up to ten contexts per request, so you can get multiple
courses or multiple users all at once. The context code format is
`resource_id` for courses, users, or groups.
[API docs](
https://canvas.instructure.com/doc/api/calendar_events.html#method.calendar_events_api.index
)
On Fri, Apr 28, 2023, 3:44 PM bbeck6 ***@***.***> wrote:
> Thanks for the reply!
> I did some more testing, trying the all_events=True flag only. What I
> noticed is that this will ONLY send back events associated purely with the
> 'user' (me), and not events that are tied to a particular 'course'
> calendar. These are the ones that need to be edited.
>
> I've tried supplying context_code='course_######' but this doesn't
> return anything. Is this intended to work? I'm at a loss as to how to grab
> calendar events associated with a course. If you could post even one
> working example, I would be most grateful.
>
> Thanks!
>
> —
> Reply to this email directly, view it on GitHub
> <#615 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AA5SY6VD52VCCVFTQZYM23LXDQM3FANCNFSM6AAAAAAXOPLM6E>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>
|
Beta Was this translation helpful? Give feedback.
-
Hi all,
Maybe someone can help. I can't tell if this is a bug or I'm using the method incorrectly. When I call the following:
obj_canvas = Canvas(API_URL, API_KEY)
pl_events = obj_canvas.get_calendar_events()
the returned object pl_events (a paginated list of calendar events) contains no data. i.e., pl_events[0] results in an out-of-range error.
I've tried everything I can think of as an input argument, but this function never returns anything. Can someone give an example of how to make it work? All of my other API code on the obj_canvas object is working fine.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions