Fetch Recurring events with google calendar api v3 in php
Asked Answered
T

2

5

I am using google calendar api v3 to fetch calendar events. But how to fetch all the recurring events. It just return single event with some hint like: DAILY;UNTIL=20 etc. Please help me out with this...

Tortilla answered 17/4, 2013 at 17:32 Comment(1)
Please post your code - what have you tried already?Tamper
G
20

If you are using the Events: list API method, add the singleEvents=true parameter. From the API docs:

singleEvents

boolean

Whether to expand recurring events into instances and only return single one-off events and instances of recurring events, but not the underlying recurring events themselves. Optional. The default is False.

Genvieve answered 15/1, 2014 at 0:58 Comment(5)
This should be marked as the correct answer - simple and very accurate. Thanks, +1Overlooker
Thanks @rebello95! Glad to be of help.Genvieve
It's nice when there's a magic parameter that solves my problem.Bhayani
This is the answer I was looking for. Thanks.Iene
Thanks, saved me from complicated over-engineered solutions.Acceptable
A
3

If the event is a recurring event. You need to call another function in the API with the event ID and that will then return all the instances.

What does this mean 1) you get a normal even listing from the API. 2) then if you find an event that has ReccurenceID/Recurrence you can call the following with the EVENT ID. You can also specify parameters that you want to just like when searching for normal events (almost)

GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId/instances

Here is a nice blog post on it. http://googleappsdeveloper.blogspot.com/2011/12/calendar-v3-best-practices-recurring.html

The google API page is at: https://developers.google.com/google-apps/calendar/v3/reference/events/instances

Cheers

Peter

Almshouse answered 29/4, 2013 at 22:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.