We're speaking at
CFUnited 2008:
CFUnited - The Premiere ColdFusion Technical Conference

Search

Calendar

SunMonTueWedThuFriSat
    123
45678910
11121314151617
18192021222324
25262728293031

Subscribe Enter your email address to subscribe to this blog. You'll receive an email when we write a new post.

Recent Entries Come On In, Rails-The Water's Warm
Shan's Simple Examples: File uploads with Flex and ColdFusion

Recent Comments Google Calendar API - Creating a new Calendar with ColdFusion
Steve Julian said: When and where are you going to post the finished CFC's ? Thanks [more]

Three Phases of Programmer Development
Pat Branley said: I normally think of those phase 2 people as 'programmers' and the phase 3 people as 'developers'. I... [more]

New Job Title: Front End Engineer
Sean Corfield said: Well, there's always the excellent Fusion Authority Quarterly Journal... [more]

Down To The Wire: HTTP Sniffers
Brian M said: I second the mention of the Charles Web Debugging Proxy that Tariq mentioned. It is fantastic. It s... [more]

New Job Title: Front End Engineer
Patrick said: Heya Sean. Good point. I never understood how they did things over there at SysCon, and I understand... [more]

Archives By Subject Business of Software (4) [RSS]
ColdFusion (318) [RSS]
Conferences (6) [RSS]
Databases (87) [RSS]
Flex & Flash (109) [RSS]
Fusebox (87) [RSS]
General Development (29) [RSS]
Google (9) [RSS]
Hardware (5) [RSS]
JVM & Java (132) [RSS]
Linux (20) [RSS]
Miscellaneous (254) [RSS]
Performance (8) [RSS]
SeeFusion (36) [RSS]
Shan's Simple Examples (6) [RSS]
User Interface (3) [RSS]
Windows (5) [RSS]

Archives By Poster Daryl Banttari (10)
Nat Papovich (29)
Patrick Quinn (36)
Shannon Hicks (22)
Steve Nelson (21)
Tyson Vanek (3)


bottom corner

Google Calendar XML: Deciphering the Data

In my previous post we looked at getting a list of calendars using the Google API. We looked at how to make the request, but not what to do with the data Google sends back.

When you make a request for a list of calendars, Google sends the list back in an xml format. Some of it is fairly self explanatory but some of it is a bit of a mystery. For that matter I'm still not 100% certain what all of it is for, but I want to focus your attention on one area of data that is important.

First do this:

<cfinvoke component="GoogleCalendar" method="getCalendars" returnvariable="getCalendars">
   <cfinvokeargument name="subSessionToken" value="abcdefgYOURSUBSESSION">
   <cfinvokeargument name="gsessionid" value="abcdefgYOURGSESSION">
   <cfinvokeargument name="includeAllCalendars" value="0">
</cfinvoke>

<cfdump var="#getCalendars#">

This is assuming you've been following along with my other posts. When you run that code above it will display a data dump of the xml returned from Google.

Take a look at the "entry" sections. These are the individual calendars. (This is also assuming you've created at least one calendar) There should be an entry for each calendar. Drill down a little further and take a look at the various links, each calendar entry should have four links.

alternate - This URL gives you a list of all the entries for the calendar.
accessControlList - This URL gives you a list of who can modify the calendar
self - This URL provides the same basic information that you're looking at now, except for ONLY one calendar
edit - This URL is what you use for editing the entries in a calendar

I think what you'll find is that this is a very incomplete list of what you can do with the calendars. So personally i find this list to be a bit silly. For example, it doesn't display the URL for batch processing. Of course in the docs it will say things like "send a DELETE request to the calendar's edit URL" which is a pretty lame explanation. These URLs should be in the docs, not in the XML data.

What SHOULD be in this XML is the calendar ID. It's there, just hidden. If you look at each of those URLs you'll see the same string, most likely a URL-Encoded version of your gmail address, although not always. Basically on the end of each of those URLs is the ID for the calendar. If you look a little above the "link" values you'll see an "ID" value. But it's not just the calendar's ID, it's a full URL! Google doesn't give you the basic ID directly (because that would be too easy!) you have to extract it out of the "ID" URL. No, it's not hard, just messy.

That calendar ID (not the URL, the actual ID!) is important for our other methods. Here's how to extract it from the "ID" URL:

<cfloop from="1" to="#arraylen(getCalendars.feed.entry)#" index="count">
<cfoutput>#listlast(filelist.feed.entry[count].id.xmltext,"/")#</cfoutput>
</cfloop>

So that will loop over each calendar and display the calendar's actual ID for use with the other API methods. Now that we have the calendar ID, next we'll look at editing a calendar.

Goog Luck! -Steve Nelson

Comments
Your audience anxiously awaits the next post ... and the post of the full CFC even more anxiously :)
# Posted By Louis | 2/28/08 7:59 PM
Ooooh sorry it's been so long since my last confession! I've been slammed lately. I'll try and squeeze some time in.
# Posted By Steve Nelson | 4/3/08 6:37 PM

bottom corner