How do I publish a dynamic event calendar feed for Google Calendar?

I am creating a webapp that handles certain types of events for users. I want to provide a way to display these events inside a Google Custom Calendar.

In fact, I was hoping that you could publish my own calendar compatible with Google Calendar and allow users to subscribe to it, since they can subscribe to "interesting calendars." To change events or add new events are reflected in their calendar. But it looks like Google only allows users to import calendar data in ical or csv format, rather than into the Atom feed format.

The problem is that existing events in my webapp can change and new events are added. I want these changes to be immediately reflected in the Google calendar. And I cannot expect the user to save the reimport of the ICAL file. The following SO question is very similar, but there really is no answer: Create a Google Calendar compatible feed

Am I really wrong? Do I need to use the gdata API to create a calendar and publish events? Publishing an Atom feed seems to be a lot easier, but if Google can't sign up for an Atom feed, it won’t work.

If I just publish my events as an ICAL file, will the Google calendar re-read the URL regularly and update the data? For some users, I have 4 or 5 events a day, so over time the file will become larger and larger. This seems like a bad decision.

+7
atom-feed google-calendar gdata gdata-api
source share
3 answers

Looking at other sites that do this, it seems like google regularly rereads external calendars in a regular format.

Then you need to trim the feed you provide, for example, by killing dates in the past.

So, to solve your problem:

  • generate the file and download it from your website.
  • Sign up for a subscription on Google Calendar
  • regularly update the ics file, trim old data

Examples of headers and running the ics file from TripIt.com, where this seems to work well:

curl -v http://..../tripit.ics < HTTP/1.1 200 OK < Server: nginx < Date: Fri, 29 Jan 2010 21:53:58 GMT < Content-Type: text/calendar; charset=utf-8 < Transfer-Encoding: chunked < Connection: close < Expires: Fri, 29 Jan 2010 22:08:58 GMT < Cache-Control: private < BEGIN:VCALENDAR X-WR-CALNAME:Malcolm Box (TripIt) X-WR-CALDESC:TripIt Calendar X-PUBLISHED-TTL:PT15M PRODID:-//John Papaioannou/NONSGML Bennu 0.1//EN VERSION:2.0 BEGIN:VEVENT ... 
+6
source share

ICal users, at least, can subscribe directly to the ics file. I found that iCal shows my updates for 20 minutes or so, and even this delay I suspect is due to the calendar that I use (JEvents) only updates the ics file so often.

Google Calendar takes several hours to show my changes - even if I unsubscribe and create a new subscription to the same URL, I see events that have been deleted long ago.

+2
source share

It looks like you are updating the Google calendar reliably, you should use the API: http://code.google.com/apis/calendar/data/2.0/developers_guide.html , although I will bid from a pragmatic point if you have an ical file, which is updated often enough, you get decent performance.

0
source share

All Articles