Search code examples
phpzend-frameworkgdata-apigdatagoogle-calendar-api

Getting Zend_GData Feed for a Specific Google Calendar


I had a long detailed question about how to get a specific calendar's event feed, but figured (I think) a solution out before I posted. However, even with the solution I'm left wondering what I'm missing about this process. To get a single calendar's event feed (or to search that feed) I do the following:

  • Authenticate (obviously)
  • Get a list of Calendars: getCalendarListFeed();
  • Get the id property from one of the 'calendar' objects
  • Change: .../calendar/feeds/default/XXX%40YYY
  • To: .../calendar/feeds/XXX%40YYY/private/full
  • Pass that to getCalendarEventFeed() to query for that calendar.

Why do I have to manipulate the ID? It seems like the documentation for Zend_Gdata is spread over both Google's and Zend's sites. I haven't located a good reference on available properties from getCalendarListFeed(), so maybe I should grab something other than the ID?

It seems like there has to be more straightforward way - what am I missing here?


Solution

  • You don't have to manipulate the ID.

    If you look at the protocol guide, there's a <link rel="alternate" .../> element which contains the URL you want.

    In the PHP client, you can retrieve this link by calling:

    // $entry is an instance of Zend_Gdata_Calendar_ListEntry
    $link = $entry->getAlternateLink()->getHref();
    

    Also, the documentation you're looking for is here: http://framework.zend.com/apidoc/1.9/Zend_Gdata/Calendar/Zend_Gdata_Calendar_ListEntry.html