简体   繁体   中英

Fetch Recurring events with google calendar api v3 in php

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...

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM