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
Related
I have implemented Recurring Event with google api and I want to integrate office 365 calendar recurring as well, I can read the event from office 365 calendar api, but when I want to take only changed instances I can not find any api endpoint that return only changes like google does.
I'm using endpoints like:
GET https://graph.microsoft.com/me/calendars/{calendarId}/calendarview
GET https://graph.microsoft.com/me/calendars/{calendarId}/events
Endpoint 'events' return main recurring event, this is what I'm using to read the main event, and works fine.
Endpoint 'calendarView' returns all events calculated for recurring event, if is daily without end, it will return 365 events for whole year if you query that way.
The problem is I can't read updated or deleted instances for this recurring event. I tried delta/feed endpoint but returns everything without any status or information for updated or deleted instances/occurrences.
Does anyone have found any solution for this?
Thank you.
AFAIK, this is not supported currently. Being said that, consider filing user voice for your specific ask so that it could be considered for future implementation.
I'm trying to clear the contents of a secondary Google Calendar in PHP but I see in the API documentation that the clear() method only works on the accounts primary calendar and wont take parameters for a secondary calendar calendar ID. Instead it says to use the delete() method but I do not want to delete the calendar all together, just delete its contents.
//legal
$service->calendars->clear('primary');
//Illegal
$service->calendars->clear($calendarId);
What would be the most effective way to clearing the events of a secondary calendar in the API?
You can actually delete events from your secondary calendar like you would in your primary. Use the Events: delete and provide the calendarid and eventId. But, take note that in your secondary calendar, your calendarId is no longer your default email. It's different. (Calendar-> calendar settings -> Calendar Address )
You can give it a Try-it to test this.
Using Office 365 REST API I can easily read the main calendar of a given account. A simple example using PHP is given here.
But how do I read the secondary calendars like "test" shown in the screenshot below? Events from secondary calendars don't show up in the API requests. Somehow it makes sense that I must tell the API which calendar I want to access (there could be many of them), but where or how in the API call do I do that?
I found the answer here:
Get a collection of series master and single instance events from the
user's primary calendar (../me/events) or from a different calendar.
GET
https://outlook.office.com/api/v2.0/me/calendars/{calendar_id}/events
where {calendar_id} is the ID of the calendar you wish to access.
You can find how to obtain the ID in this answer.
It works.
I have a restaurant reservation website build with Laravel and running for merchant and customer.
What I would like to do is, when customer successfully booked at merchant's restaurant, I would like to sync reservation data to "merchant's google calendar" as well as "customer's google calendar".
Is it possible to do with Google Calendar? If so what's the approach to do that?
What would be the seamless approach to sync data between their own calendar and my calendar (from my website)?
As far as I understand your use case from the comments, you actually need to do two different things:
1. Keep the merchant's calendar up to date
For this, a sync might indeed be the best solution. A Calendar API "sync" is just a usual read operation which includes a sync token you can use in later reads to reduce the number of needed operations. It is described in the docs.
2. Add the event to the customer's calendar
You do not want to sync your calendar with the customers' calendar here, just add one event. Of course, you can add an event via the API; however, a much better solution seems to be providing a link for the customer to add the event himself:
https://www.google.com/calendar/render?action=TEMPLATE&text=Your+Event+Name&dates=20150998T224000Z/20150998T221500Z&details=For+details,+link+here:+http://www.example.com&location=Waldorf+Astoria,+301+Park+Ave+,+New+York,+NY+10022&sf=true&output=xml
It is much easier technically, and the customer does not need to give you full access to his calendar (there is no write-only permission).
I would like to basically get all the events that i get invited to on facebook to feed my internal website DB with that info; lets say every day using a cron. the problem is that I think you can get the events if you are the one posting the event not the one receiving the invite.
am I wrong or can someone offer me some insight into how to get this accomplished
You can get the events you have not replied using me/events/not_replied or using Graph Api Explorer.
You can get all upcoming events that you have subscribed/accepted via me/events call. Graph APi Exlporer
and save the time in your db and use since parameter with that time to get latest subscribed events.
If you are running cron job then make sure you are not duplicating or missing some events.