<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Boundary Conditions &#187; GCalendar</title>
	<atom:link href="http://67central.com/bc/category/gdata/gcalendar/feed/" rel="self" type="application/rss+xml" />
	<link>http://67central.com/bc</link>
	<description>Exploring Calendars, Time Lines, Timekeeping and Scheduling Tools</description>
	<lastBuildDate>Thu, 25 Nov 2010 15:56:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Restyle Google Calendar</title>
		<link>http://67central.com/bc/2009/04/03/restyle-google-calendar/</link>
		<comments>http://67central.com/bc/2009/04/03/restyle-google-calendar/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 18:25:43 +0000</pubDate>
		<dc:creator>Ray Baxter</dc:creator>
				<category><![CDATA[GCalendar]]></category>

		<guid isPermaLink="false">http://67central.com/bc/?p=160</guid>
		<description><![CDATA[Linden LAN » Blog Archive » Restyle Google Calendar 4.]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.lindenlan.net/2008/12/04/restyle-google-calendar-4/'>Linden LAN  » Blog Archive   » Restyle Google Calendar 4</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://67central.com/bc/2009/04/03/restyle-google-calendar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Events to Secondary Google Calendars in Python</title>
		<link>http://67central.com/bc/2008/09/28/adding-events-to-secondary-google-calendars-in-python/</link>
		<comments>http://67central.com/bc/2008/09/28/adding-events-to-secondary-google-calendars-in-python/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 19:49:42 +0000</pubDate>
		<dc:creator>Ray Baxter</dc:creator>
				<category><![CDATA[Calendar]]></category>
		<category><![CDATA[GCalendar]]></category>
		<category><![CDATA[GData]]></category>
		<category><![CDATA[SecondaryCalendarEvents]]></category>

		<guid isPermaLink="false">http://67central.com/bc/?p=86</guid>
		<description><![CDATA[Before writing, I assumed that I would need to refer any reader to the introductory post of this series on adding events to secondary calendars. Depending on your skill level and experience that may still be true, and it definitely is true if you want to understand what you are doing, but if you just [...]]]></description>
			<content:encoded><![CDATA[<p>Before writing, I assumed that I would need to refer any reader to the <a href="http://67central.com/bc/2008/09/01/adding-events-to-secondary-google-calendars/">introductory post</a> of this series on adding events to secondary calendars. Depending on your skill level and experience that may still be true, and it definitely is true if you want to understand what you are doing, but if you just want to get it done, you can probably muddle through with the following instructions. </p>
<p>Here&#8217;s the really short story: when you call the <a href="http://gdata-python-client.googlecode.com/svn/trunk/pydocs/gdata.calendar.service.html">insertEvent</a> method, you pass the event that you are creating and optionally, the edit url of the calendar where you want the event to appear. So, to create an event on a secondary calendar, just pass the edit link of the calendar. (You can get the edit link of a calendar in python by calling <code>GetEditLink().href</code> on it.)</p>
<p>For the longer story, I&#8217;ll assume that you have installed Python, ElementTree and the Google Data Python Library, following <a href="http://code.google.com/apis/gdata/articles/python_client_lib.html">Google&#8217;s instructions</a>. </p>
<p>Run through the tests and the sample code. When I ran the calendarExample.py it failed with this stack trace:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Traceback <span style="color: #7a0874; font-weight: bold;">&#40;</span>most recent call <span style="color: #c20cb9; font-weight: bold;">last</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>:
  File <span style="color: #ff0000;">&quot;./samples/calendar/calendarExample.py&quot;</span>, line <span style="color: #000000;">577</span>, <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">&lt;</span>module<span style="color: #000000; font-weight: bold;">&gt;</span>
    main<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
  File <span style="color: #ff0000;">&quot;./samples/calendar/calendarExample.py&quot;</span>, line <span style="color: #000000;">574</span>, <span style="color: #000000; font-weight: bold;">in</span> main
    sample.Run<span style="color: #7a0874; font-weight: bold;">&#40;</span>delete<span style="color: #7a0874; font-weight: bold;">&#41;</span>
  File <span style="color: #ff0000;">&quot;./samples/calendar/calendarExample.py&quot;</span>, line <span style="color: #000000;">498</span>, <span style="color: #000000; font-weight: bold;">in</span> Run
    self._PrintAllEventsOnDefaultCalendar<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
  File <span style="color: #ff0000;">&quot;./samples/calendar/calendarExample.py&quot;</span>, line <span style="color: #000000;">99</span>, <span style="color: #000000; font-weight: bold;">in</span> _PrintAllEventsOnDefaultCalendar
    print <span style="color: #ff0000;">'\t\t\t%s'</span> <span style="color: #000000; font-weight: bold;">%</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>a_participant.attendee_status.value,<span style="color: #7a0874; font-weight: bold;">&#41;</span>
AttributeError: <span style="color: #ff0000;">'NoneType'</span> object has no attribute <span style="color: #ff0000;">'value'</span></pre></div></div>

<p>Since all I wanted to do was to make this sample code run for the single case of adding an event to a secondary calendar, I commented out line 99, but the code should be checking that there is an attendee status before writing its value. After that change the sample code ran fine for me.</p>
<p>To insert a single event in a secondary calendar, I copied <code>calendarExample.py</code> to <code> secondaryCalendarInsert.py</code>. Then I commented out everything in the <code>Run</code> method except this line:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>503
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">    see = <span style="color: #008000;">self</span>._InsertSingleEvent<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>and made the following change,</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>266
267
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">new_event = <span style="color: #008000;">self</span>.<span style="color: black;">cal_client</span>.<span style="color: black;">InsertEvent</span><span style="color: black;">&#40;</span>event, 
  <span style="color: #483d8b;">'/calendar/feeds/g5b79g3f2bi5hc1it41seuu41c@group.calendar.google.com/private/full'</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>This instructs the InsertEvent method to create the event in my secondary calendar by <code>POST</code>ing to the url of  my &#8220;Secondary Calendar&#8221; (id <code>g5b79g3f2bi5hc1it41seuu41c@group.calendar.google.com</code>) instead of my primary calendar (id <code>default</code>). I found the calendar ID on the calendar settings page of the calendar, but as I said above, if you have accessed a calendar programatically, you can just call <code>GetEditLink().href</code> on it to get the proper link.</p>
<p>You can see that a &#8220;One Time Tennis with Beth&#8221; event was inserted beginning at the moment I did the insert and lasting for one hour, as described in the sample code. </p>
<p>[Update 2008-11-14: You can't see this if you are using Safari. In general embedded calendar's show in Safari, but there is something about this particular calendar that causes it not to display. Google does a number of separate calls and redirects to obtain the correct data for this calendar and it looks like one of the calls returns data that doesn't correspond to the mime-types. The point that I was trying to communicate with this illustration was that the event did in fact appear and that it was on the secondary calendar.]</p>
<p><iframe src="http://www.google.com/calendar/embed?showTitle=0&amp;showNav=0&amp;showDate=0&amp;showPrint=0&amp;showTabs=0&amp;showTz=0&amp;mode=WEEK&amp;dates=20080928%2F20081004&amp;height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=calendar.maven%40gmail.com&amp;color=%232952A3&amp;src=g5b79g3f2bi5hc1it41seuu41c%40group.calendar.google.com&amp;color=%235229A3&amp;ctz=America%2FLos_Angeles" style=" border-width:0 " width="600" height="600" frameborder="0" scrolling="no"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://67central.com/bc/2008/09/28/adding-events-to-secondary-google-calendars-in-python/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Q &amp; A &#8211; Sharing Calendars</title>
		<link>http://67central.com/bc/2008/09/09/q-a-sharing-calendars/</link>
		<comments>http://67central.com/bc/2008/09/09/q-a-sharing-calendars/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 03:41:09 +0000</pubDate>
		<dc:creator>Ray Baxter</dc:creator>
				<category><![CDATA[Calendar]]></category>
		<category><![CDATA[GCalendar]]></category>
		<category><![CDATA[Visual Elements]]></category>

		<guid isPermaLink="false">http://67central.com/bc/?p=83</guid>
		<description><![CDATA[This is a little out of my normal area here, but I received this question in my email and I figured I&#8217;d answer it here for everyone&#8217;s future reference. Maybe I&#8217;ll become the next &#8220;Ask Dave&#8220;? On Sep 9, 2008, at 9:05 AM, nadine wrote: Dear Ray, I do hope you don’t mind my email [...]]]></description>
			<content:encoded><![CDATA[<p>This is a little out of my normal area here, but I received this question in my email and I figured I&#8217;d answer it here for everyone&#8217;s future reference. Maybe I&#8217;ll become the next &#8220;<a href="http://www.askdavetaylor.com/">Ask Dave</a>&#8220;? </p>
<blockquote><p>On Sep 9, 2008, at 9:05 AM, nadine wrote:<br />
Dear Ray,</p>
<p>I do hope you don’t mind my email you… I am desperate!!! </p>
<p>I work for a gentleman who in turn works for 6 different companies.  Because his calendar entries need to be colour coded I have obviously set up a calendar representing each different company which shows a different colour.  This works fine between he and I. </p>
<p>However, he would like to share his calendar with a number of colleagues.  Do I firstly have to ask each of his colleagues to open a Google account and then do I send an invite to them?  However, I think this invites them only to his one calendar and not to all the associated company calendars?<br />
 <span id="more-83"></span><br />
If you are able to advise, I’d be most grateful.  I have trawled the net for approx three hours without success.</p>
<p>Thanks,<br />
Nadine
</p></blockquote>
<p>Hi Nadine,</p>
<p>It depends on what you mean by share.</p>
<p>If your employer wants to share 6 different calendars with another person, and that person will have access to add and delete events, or add other persons to those who can view those calendars, he will need to send 6 separate invitations to that person.</p>
<p>If he wants to do exactly the same for a number of other people, then he still only has to send 6 invitations, but include all of the other people.</p>
<p>There are a couple of easier alternatives, though, if the others don&#8217;t need to make changes to the company calendars.</p>
<p>You can see one example at my blog, http://67central.com/bc/calendar/. On that page I have displayed 5 different calendars, that anyone can see. These are embedded calendars using the Google Calendar Embed tool to present 5 calendars, all in different colors on a single web page. If you have your own web server or web page, you could add code to a page and your employers colleagues could view it. They could also add the events to their personal calendars.</p>
<p>One small fly in the ointment of that approach is that the content will be visible to anyone which may be a concern, depending on what is on the calendar.</p>
<p>Finally, you can just send the colleagues the private urls for the 6 calendars. On the settings page of each Google calendar, there are 3 links for the &#8220;Private Address.&#8221; These are links to the XML, HTML, and iCal formatted versions of the calendar. If you send the colleagues the 6 HMTL private links for each color coded company, then the colleagues can view the calendars in their web browser. If you send them the XML links they will be able to subscribe to those calendars in Google and finally if you send them the iCal links, the colleagues will be able to add those calendars to many different types of calendaring software.</p>
<p>I hope that helps,</p>
<p>Ray</p>
]]></content:encoded>
			<wfw:commentRss>http://67central.com/bc/2008/09/09/q-a-sharing-calendars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Events to Secondary Google Calendars</title>
		<link>http://67central.com/bc/2008/09/01/adding-events-to-secondary-google-calendars/</link>
		<comments>http://67central.com/bc/2008/09/01/adding-events-to-secondary-google-calendars/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 19:00:59 +0000</pubDate>
		<dc:creator>Ray Baxter</dc:creator>
				<category><![CDATA[Calendar]]></category>
		<category><![CDATA[GCalendar]]></category>
		<category><![CDATA[GData]]></category>
		<category><![CDATA[SecondaryCalendarEvents]]></category>

		<guid isPermaLink="false">http://67central.com/bc/?p=20</guid>
		<description><![CDATA[The most frequently asked question posed in the Google Calendar Date API Group is, &#8220;How do I add events to a secondary calendar?&#8221; In this series of posts, I am going to attempt to provide an answer for using every language that has a client library. I discuss the &#8220;official&#8221; client libraries for Python, Php, [...]]]></description>
			<content:encoded><![CDATA[<p>The most frequently asked question posed in the <a href="http://groups.google.com/group/google-calendar-help-dataapi">Google Calendar Date API Group</a> is, &#8220;How do I add events to a secondary calendar?&#8221;</p>
<p>In this series of posts, I am going to attempt to provide an answer for using every language that has a client library. I discuss the &#8220;official&#8221; client libraries for Python, Php, .NET, Java and Javascript as well as the slightly less official Objective-C library and some of the attempts to create Ruby library for interacting with Google Calendar and GData. If there are other client libraries, just let me know in the comments and I&#8217;ll add instructions here, or link to them elsewhere as I have time, interest and understanding.</p>
<p>I start with describing how to POST XML to a calendar url. This is &#8220;The Protocol&#8221;.  You should read this information about the protocol, even if you plan to use a client library. Each client library is using this protocol under the covers, so understanding what is happening will help you better use your client library. In addition, I&#8217;ll only explain some terms in this section, so you&#8217;ll need to read it to understand what I am talking about.</p>
<p>All information in these posts comes from the Google Developer&#8217;s Guides, the Client Library Documentation, the source code for the client library and my own exploration and testing. I&#8217;ll provide links to these resources in the text as appropriate. For simplicity&#8217;s sake, I only cover creating single-occurrence events for users that have properly authenticated using client login. These cases should be sufficient for illustrating how to add to secondary calendars, but 1) I&#8217;m not aware of any differences in creating single-occurrence versus quickadd or recurrent events on secondary calendars in any of the client libraries and 2) I haven&#8217;t used AuthSub. </p>
<p>I have personally tested all of the code that I present here, unless otherwise noted. That means that I was able to create an event on a calendar using that code. In all cases, I am adding events to my <a href="http://www.google.com/calendar/embed?src=2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com&#038;ctz=America/Los_Angeles">Secondary Calendar</a> which is public, so have a look. I&#8217;ll be trying to add an event that occurs at the time when the relevant article is posted.</p>
<p>Here is a table of contents of the language-specific treatments. I&#8217;ll update the links as I complete the sections.</p>
<p><a href="http://67central.com/bc/2008/09/28/adding-events-to-secondary-google-calendars-in-python/">Python</a> &#8211; Complete September 29, 2008<br />
Php<br />
.NET<br />
Java<br />
Javascript<br />
Objective C<br />
Ruby</p>
<p><span id="more-20"></span></p>
<h2>The Protocol</h2>
<p>To create an event on any Google Calendar you POST the appropriate XML to the calendar&#8217;s url. The easiest way to obtain the appropriate XML is to start with an existing event. The easiest way to obtain the calendar&#8217;s url, well, that&#8217;s a really the rub.</p>
<p>Here&#8217;s what Google says about finding the appropriate url:</p>
<blockquote><p>To post an entry, send the following HTTP request to Calendar, using a special &#8220;default&#8221; URL (and an Authorization header; see the section on authentication above). Calendar automatically redirects the default URL to the URL of the read/write private feed of the calendar belonging to the authenticated user. (Note that you don&#8217;t have to use the default URL to send a POST request to Calendar; you can specify the user ID instead of &#8220;default&#8221; if you prefer. For more information, see the <a href="http://code.google.com/apis/calendar/reference.html#Feeds">Calendar feed types</a> reference.)</p></blockquote>
<p>This is the source of all the confusion on the issue of creating events on secondary calendars.<br />
As mentioned  further on after this quote, the &#8220;default&#8221; URL is<br />
<code>http://www.google.com/calendar/feeds/default/private/full</code><br />
If you specify the user ID, this would be <code>http://www.google.com/calendar/feeds/user@gmail.com/private/full</code>, you get another URL for the user&#8217;s primary calendar. You can POST to this url and create events. </p>
<p>The question is, what is the user ID for a secondary calendar? If the calendar belongs to your friend, then <code>http://www.google.com/calendar/feeds/friend@gmail.com/private/full</code> works. Suppose that I have created a personal calendar and a work calendar. The user ID for my personal (primary) calendar is my gmail address. What is the user ID for my work calender? My gmail address? No, that is the user ID for my personal calendar. </p>
<p>The problem is that Google doesn&#8217;t use the term user ID consistently and what they really mean here is what they call calendar ID in <a href="http://code.google.com/apis/calendar/developers_guide_protocol.html#UpdatingCalendars">other contexts</a>.</p>
<p>To get the calendar ID, there are a couple of methods. </p>
<p>Google suggests that you parse the calendar ID from the calendar&#8217;s edit link in the allcalendars feed. Here is the entire entry for my secondary calendar from the all calendar&#8217;s feed.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  http://www.google.com/calendar/feeds/default/allcalendars/full/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-09-01T05:24:24.673Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-09-01T04:13:31.000Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Secondary Calendar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;summary</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>This calendar is for testing and
  illustrating the creation of events using the Google Calendar
  Data API on a secondary calendar.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/summary<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">src</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'alternate'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'http://schemas.google.com/acl/2007#accessControlList'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/acl/full'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'self'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/default/allcalendars/full/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'edit'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/default/allcalendars/full/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Secondary Calendar<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:timezone</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'America/Los_Angeles'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:timesCleaned</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'0'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:hidden</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'false'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:color</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'#5229A3'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:selected</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'true'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:accesslevel</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'owner'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:where</span> <span style="color: #000066;">valueString</span>=<span style="color: #ff0000;">''</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>So, Google is suggesting that you take the element <code>
<link rel='edit' ...  .></code> element , parse out the href, extract the calendar ID, &#8220;2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com&#8221;, and substitute it into &#8220;http://www.google.com/calendar/feeds/default/<calendar ID>/full&#8221;. That works, but isn&#8217;t the most intuitive series of steps.</p>
<p>A more direct way is to just use the <code>src</code> attribute of the content. Since the content of the calendar is empty, <a href="http://tools.ietf.org/html/rfc4287#section-4.1.3">Atom specifies</a> that the <code>src</code> attribute must be present, and contain a link to the content. That&#8217;s a long way of saying, &#8220;This is the link that we want!&#8221; To read the content of a calendar, GET the url indicated by the <code>src</code> attribute link of the content. To create an event, POST appropriately formed XML to the <code>src</code> attribute link of the calendar. This is REST 101.</p>
<p>Note that the link in the <code>src</code> attribute of the content is exactly the same as the <code>alternate</code> link. This might be useful information as we work through the various client libraries.</p>
<p>The easiest method is to look it up manually through the UI. In the UI, under the Calendar Details tab of Calendar Settings, there is a section for Calendar Address and included in that section is a parenthetical notation of the Calendar ID. </p>
<p>Note that this is called Calendar ID whether the calendar is the user&#8217;s primary calendar (in which case the calendar ID is also the user ID) or a secondary calendar, in which case it is some other user&#8217;s email address, or a long string that looks like an e-mail address for an obscure user in the group.calendar.google.com domain, like <code>2v78cr597kh4kduf3db9t4p1es@group.calendar.google.com</code>. That by the way is the calendar ID in my <a href="http://www.google.com/calendar/embed?src=2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com&#038;ctz=America/Los_Angeles">Secondary Calendar</a>. You can see how Google has used the calendar ID as the <code>src</code> parameter in the link to that calendar, <code>http://www.google.com/calendar/embed?src=2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com</code>.</p>
<p>So now the hard part is over. We have the correct url. Here&#8217;s the XML that we&#8217;ll send as the data in our post request, cribbed from the <a href="http://code.google.com/apis/calendar/developers_guide_protocol.html#CreatingEvents">Developer&#8217;s Guide</a> and modified for our purposes. Follow that link for more details about how additional elements will be added on creation.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">'http://www.w3.org/2005/Atom'</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:gd</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#kind'</span></span>
<span style="color: #009900;">    <span style="color: #000066;">term</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event'</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/category<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>POSTed XML<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>I was POSTed using hand-crafted XML via the Protocol!<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:transparency</span></span>
<span style="color: #009900;">    <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.opaque'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gd:transparency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:eventStatus</span></span>
<span style="color: #009900;">    <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.confirmed'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gd:eventStatus<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:when</span> <span style="color: #000066;">startTime</span>=<span style="color: #ff0000;">'2008-09-01'</span></span>
<span style="color: #009900;">    <span style="color: #000066;">endTime</span>=<span style="color: #ff0000;">'2008-09-02'</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/gd:when<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Wrap this up in a script that I have that does authentication and handles the redirects and POST that <code><entry></code> to</p>

<div class="wp_syntax"><div class="code"><pre class="xm" style="font-family:monospace;">https://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es@group.calendar.google.com/private/full</pre></div></div>

<p>.</p>
<p>Below is Google&#8217;s response. More importantly, see the resulting event <a href="href='http://www.google.com/calendar/event?eid=NXEzOHExOWgyczc1NnVtODkwMmI5ZjdtcnMgMnY3OGNyNTk3a2g0a2R1ZjNkYjl0NHAxZXNAZw'">here</a>. Enjoy.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">'1.0'</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">'utf-8'</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">'http://www.w3.org/2005/Atom'</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns:batch</span>=<span style="color: #ff0000;">'http://schemas.google.com/gdata/batch'</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns:gCal</span>=<span style="color: #ff0000;">'http://schemas.google.com/gCal/2005'</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns:gd</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full/5q38q19h2s756um8902b9f7mrs<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-09-01T11:32:34.000Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-09-01T11:32:35.000Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#kind'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">term</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>POSTed XML<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>I was POSTed using hand-crafted XML via the
  Protocol!<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'alternate'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text/html'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/event?eid=NXEzOHExOWgyczc1NnVtODkwMmI5ZjdtcnMgMnY3OGNyNTk3a2g0a2R1ZjNkYjl0NHAxZXNAZw'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">title</span>=<span style="color: #ff0000;">'alternate'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'self'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full/5q38q19h2s756um8902b9f7mrs'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'edit'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full/5q38q19h2s756um8902b9f7mrs/63355951955'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Calendar Maven<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;email<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>calendar.maven@gmail.com<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/email<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:comments<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:feedLink</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/2v78cr597kh4kduf3db9t4p1es%40group.calendar.google.com/private/full/5q38q19h2s756um8902b9f7mrs/comments'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gd:comments<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:eventStatus</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.confirmed'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:visibility</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.default'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:transparency</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.opaque'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:uid</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'5q38q19h2s756um8902b9f7mrs@google.com'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:sequence</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'0'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:when</span> <span style="color: #000066;">startTime</span>=<span style="color: #ff0000;">'2008-09-01'</span> <span style="color: #000066;">endTime</span>=<span style="color: #ff0000;">'2008-09-02'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:who</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.organizer'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">valueString</span>=<span style="color: #ff0000;">'Secondary Calendar'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">email</span>=<span style="color: #ff0000;">'2v78cr597kh4kduf3db9t4p1es@group.calendar.google.com'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:where</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://67central.com/bc/2008/09/01/adding-events-to-secondary-google-calendars/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Link Elements in GCalendar Calendar Feeds</title>
		<link>http://67central.com/bc/2008/05/15/link-attributes-in-gcalendar-calendar-feeds/</link>
		<comments>http://67central.com/bc/2008/05/15/link-attributes-in-gcalendar-calendar-feeds/#comments</comments>
		<pubDate>Thu, 15 May 2008 07:02:08 +0000</pubDate>
		<dc:creator>Ray Baxter</dc:creator>
				<category><![CDATA[Calendar]]></category>
		<category><![CDATA[GCalendar]]></category>
		<category><![CDATA[GData]]></category>

		<guid isPermaLink="false">http://cornercases.67central.com/?p=8</guid>
		<description><![CDATA[Here for reference is a complete listing of the rel and type attributes I have observed for link elements in Google Calendar feeds. These are a superset of the attributes contained in link elements found in event feeds. Google Calendar feeds do not use all available combinations of permitted Atom link elements. A complete list [...]]]></description>
			<content:encoded><![CDATA[<p>Here for reference is a complete listing of the <code>rel</code> and <code>type</code> attributes I have observed for <code>link</code> elements in Google Calendar feeds. These are a superset of the attributes contained in <code>link</code> elements <a href="http://67central.com/bc/2008/04/27/link-elements-in-gcalendar-feeds/">found</a> in <code>event</code> feeds. Google Calendar feeds do not use all available combinations of permitted Atom link elements. A complete list of Atom link relations is <a href="http://www.iana.org/assignments/link-relations.html">here</a>. Atom requires that each element have a maximum of one link of each relation and type. Types are specified <a href="http://tools.ietf.org/html/rfc4287#section-3.1.1">here</a> for Atom elements. None of the observed relations from outside the Atom namespace have types. </p>
<pre><code>link rel='alternate' type='application/atom+xml'
link rel='alternate' type='text/calendar'
link rel='alternate' type='text/html'
link rel='edit' type='application/atom+xml'
link rel='http://schemas.google.com/acl/2007#accessControlList'
link rel='http://schemas.google.com/g/2005#batch'
link rel='http://schemas.google.com/acl/2007#controlledObject'
link rel='http://schemas.google.com/g/2005#feed'
link rel='http://schemas.google.com/g/2005#post'
link rel='next' type='application/atom+xml'
link rel='previous' type='application/atom+xml'
link rel='self' type='application/atom+xml'
</code></pre>
<h2>Notes</h2>
<p><code>Alternate</code> links point to an alternate representation of the same resource. There are three types represented in Google Calendar feeds; the <code>type</code> specifies that nature of the alternate representation. The <code>application/atom+xml</code> type alternate links are all contained inside <code><entry></code> elements and point to the individual <code>entry</code>. The <code>text/html</code> type links are to html representations of the calendar or event. The <code>text/calendar</code> are links to ics format calendar files.</p>
<p>The <code>edit</code> links are used to update or delete calendars or events. The <code>post</code> links are used to create calendars or events. The <code>edit</code> links are defined in the <a href="http://tools.ietf.org/html/rfc5023#section-11.1">Atom Publishing Protocol</a>. <code>Post</code> links are Google&#8217;s own invention.</p>
<p><code>Batch</code> links identify the uri for posting batch request. I have no experience with batch requests, but according to the <a href="http://code.google.com/apis/gdata/batch.html">documentation</a> insert, update, delete, or query operations are permitted.</p>
<p>Feed links in all observed cases are exactly the same as the <code>id</code> of the feed. The <code>self</code> links are related to the <code>feed</code> links and id, but also contain the (possibly implicit) url parameters that were used to retrieve the feed.  </p>
<p>AccessControlList links identify the location of the access control list (acl) for the feed. ControlledObject links identify the feed that the acl pertains to.</p>
<p><code>Next</code> and <code>previous</code> specify Atom Publishing Protocol <a href="http://tools.ietf.org/html/rfc5023#section-10.1">partial collections</a>.  <code>Next</code> and <code>previous</code> are <a href="http://tools.ietf.org/html/rfc5005#section-3">paged feeds</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://67central.com/bc/2008/05/15/link-attributes-in-gcalendar-calendar-feeds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Persistence of gsessionids</title>
		<link>http://67central.com/bc/2008/05/08/persistence-of-gsessionids/</link>
		<comments>http://67central.com/bc/2008/05/08/persistence-of-gsessionids/#comments</comments>
		<pubDate>Thu, 08 May 2008 22:40:00 +0000</pubDate>
		<dc:creator>Ray Baxter</dc:creator>
				<category><![CDATA[Calendar]]></category>
		<category><![CDATA[GCalendar]]></category>
		<category><![CDATA[GData]]></category>

		<guid isPermaLink="false">http://67central.com/bc/?p=12</guid>
		<description><![CDATA[I&#8217;ve read this paragraph many times, but somehow the full meaning just became apparent to me. Just like in the previous example, Calendar may return an HTTP 302 redirect; if so, then the redirect URL has a new parameter, gsessionid, appended to it. If you received the redirect, then send the same POST request again, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve read this <a href="http://code.google.com/apis/calendar/developers_guide_protocol.html#CreatingEvents">paragraph</a> many times, but somehow the full meaning just became apparent to me.</p>
<blockquote><p>Just like in the previous example, Calendar may return an HTTP 302 redirect; if so, then the redirect URL has a new parameter, <code>gsessionid</code>, appended to it.  If you received the redirect, then send the same <code>POST</code> request again, with the same Authorization header and the same content, but with the <code>gsessionid</code> parameter appended.  The response may also include a <code>S</code> cookie, which you should store and send this cookie with future requests <a href="http://www.ietf.org/rfc/rfc2109.txt">as appropriate</a>.  Please see the <a href="http://code.google.com/support/bin/answer.py?answer=55833&amp;topic=10360">knowledge base</a> for more information on handling sessions with the Calendar data API. Please note: if a session ID indicated in a cookie header conflicts<br />with the session ID passed as a gsessionid URL parameter, you will get caught in a redirect loop. </p></blockquote>
<p>The introductory clause obscures important information. Having read the previous example, I thought that there wasn&#8217;t much to be gained by reading this paragraph in detail. Just do the same thing as before, &#8220;So after you&#8217;ve sent the <code>GET</code> request, you have to read the HTTP headers of the response to find the URL with the session ID appended; then you need to send another <code>GET</code> request with that new URL.&#8221;</p>
<p>Really, I didn&#8217;t think too much. The gsessionid is a persistent session id. You can send it with any future request and if you do, and the session id matches the <code>auth</code> token your request will be accepted without redirect. Moreover you can grab the <code>S</code> cookie and stick it in your headers and not need to worry about it.This is documented <a href="http://code.google.com/support/bin/answer.py?answer=55833&#038;topic=10360">here</a>.</p>
<p>Here&#8217;s an example in action:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># get_feed is from a project I'm working on</span>
irb:01:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'get_feed'</span>                         
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">true</span>
<span style="color:#008000; font-style:italic;"># it provides an authorization method that also sets @headers and creates @http object</span>
irb:02:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> get_auth<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'me@gmail.com'</span>,<span style="color:#996600;">'top_secret'</span><span style="color:#006600; font-weight:bold;">&#41;</span>      
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;Authorization&quot;</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;GoogleLogin auth=DQAAAIQAAABECsmTToeu0o97DoPQ8v9lXDkqFYQY4tOC4QmkItA9jb1J2GfEql69SifsFF7TJJ6_lbAST3iuc-aZQUIvY3qDfPj4pNpo9_XAsCEphd9jRdqeqengYDnpTOEJJedw9jRV738b4x-EluyDKDPBw0f46fFDto0o8zkgY_bUChKK0T6j8A5PgedYRRJzQJm_oSY&quot;</span>, <span style="color:#996600;">&quot;Content-Type&quot;</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;application/atom+xml&quot;</span>, <span style="color:#996600;">&quot;Service&quot;</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;67central.com--get-feed-0.0.1&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
irb:03:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#0066ff; font-weight:bold;">@headers</span>                                   
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;Authorization&quot;</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;GoogleLogin auth=DQAAAIQAAABECsmTToeu0o97DoPQ8v9lXDkqFYQY4tOC4QmkItA9jb1J2GfEql69SifsFF7TJJ6_lbAST3iuc-aZQUIvY3qDfPj4pNpo9_XAsCEphd9jRdqeqengYDnpTOEJJedw9jRV738b4x-EluyDKDPBw0f46fFDto0o8zkgY_bUChKK0T6j8A5PgedYRRJzQJm_oSY&quot;</span>, <span style="color:#996600;">&quot;Content-Type&quot;</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;application/atom+xml&quot;</span>, <span style="color:#996600;">&quot;Service&quot;</span><span style="color:#006600; font-weight:bold;">=&gt;</span><span style="color:#996600;">&quot;67central.com--get-feed-0.0.1&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#008000; font-style:italic;"># User's default calendar and own calendars feeds</span>
irb:04:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> default =  <span style="color:#996600;">'/calendar/feeds/default'</span>          
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/calendar/feeds/default&quot;</span>
irb:05:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> all = <span style="color:#996600;">'/calendar/feeds/default/owncalendars/full'</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/calendar/feeds/default/owncalendars/full&quot;</span>
<span style="color:#008000; font-style:italic;"># Request for feeds are redirected           </span>
irb:06:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#0066ff; font-weight:bold;">@http</span>.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span>default,@headers<span style="color:#006600; font-weight:bold;">&#41;</span>       
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;Net::HTTPFound 302 Moved Temporarily readbody=true&gt;</span>
irb:07:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> response = <span style="color:#0066ff; font-weight:bold;">@http</span>.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span>all,@headers<span style="color:#006600; font-weight:bold;">&#41;</span>       
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;Net::HTTPFound 302 Moved Temporarily readbody=true&gt;</span>
<span style="color:#008000; font-style:italic;"># All calendars feed to this location, note the gsessionid</span>
irb:08:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> response<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'Location'</span><span style="color:#006600; font-weight:bold;">&#93;</span>                       
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;https://www.google.com:443/calendar/feeds/default/owncalendars/full?gsessionid=uVGhyT0F60BtaKPNVsOeig&quot;</span>
<span style="color:#008000; font-style:italic;"># Also returns this cookie       </span>
irb:09:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> response<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'set-cookie'</span><span style="color:#006600; font-weight:bold;">&#93;</span>                     
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;S=calendar=uVGhyT0F60BtaKPNVsOeig;Expires=Fri, 08-May-2009 20:54:31 GMT&quot;</span>
irb:<span style="color:#006666;">10</span>:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> s_cookie =  response<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;set-cookie&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">';'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">first</span>                                                  
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;S=calendar=uVGhyT0F60BtaKPNVsOeig&quot;</span>
irb:<span style="color:#006666;">11</span>:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> all_redirect = <span style="color:#996600;">&quot;/calendar/feeds/default/owncalendars/full?gsessionid=uVGhyT0F60BtaKPNVsOeig&quot;</span>        
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/calendar/feeds/default/owncalendars/full?gsessionid=uVGhyT0F60BtaKPNVsOeig&quot;</span>
<span style="color:#008000; font-style:italic;"># With the gsessionid, request succeeds    </span>
irb:<span style="color:#006666;">12</span>:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> response = <span style="color:#0066ff; font-weight:bold;">@http</span>.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span>all_redirect,@headers<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;Net::HTTPOK 200 OK readbody=true&gt;</span>
irb:<span style="color:#006666;">13</span>:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> default_with_redirect = default <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;?gsessionid=uVGhyT0F60BtaKPNVsOeig&quot;</span>                                        
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/calendar/feeds/default?gsessionid=uVGhyT0F60BtaKPNVsOeig&quot;</span>
<span style="color:#008000; font-style:italic;"># So does this one                         </span>
irb:<span style="color:#006666;">14</span>:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> response = <span style="color:#0066ff; font-weight:bold;">@http</span>.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span>default_with_redirect,@headers<span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;Net::HTTPOK 200 OK readbody=true&gt;</span>
<span style="color:#008000; font-style:italic;"># Set the cookie                        </span>
irb:<span style="color:#006666;">15</span>:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> <span style="color:#0066ff; font-weight:bold;">@headers</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'Cookie'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = s_cookie                
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;S=calendar=uVGhyT0F60BtaKPNVsOeig&quot;</span>
<span style="color:#008000; font-style:italic;"># And both request succeed without gsessionid                     </span>
irb:<span style="color:#006666;">16</span>:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> response = <span style="color:#0066ff; font-weight:bold;">@http</span>.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span>all,@headers<span style="color:#006600; font-weight:bold;">&#41;</span>         
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;Net::HTTPOK 200 OK readbody=true&gt;</span>
irb:<span style="color:#006666;">17</span>:<span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&gt;</span> response = <span style="color:#0066ff; font-weight:bold;">@http</span>.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span>default,@headers<span style="color:#006600; font-weight:bold;">&#41;</span>         
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;Net::HTTPOK 200 OK readbody=true&gt;</span></pre></div></div>

<p>I hope that is useful to some one. There is a claim in the documentation (I&#8217;ve temporarily lost it) that the API libraries will handle these session ids and cookies automatically. Good to know.</p>
]]></content:encoded>
			<wfw:commentRss>http://67central.com/bc/2008/05/08/persistence-of-gsessionids/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Link Elements in GCalendar Event Feeds</title>
		<link>http://67central.com/bc/2008/04/27/link-elements-in-gcalendar-feeds/</link>
		<comments>http://67central.com/bc/2008/04/27/link-elements-in-gcalendar-feeds/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 06:14:40 +0000</pubDate>
		<dc:creator>Ray Baxter</dc:creator>
				<category><![CDATA[Calendar]]></category>
		<category><![CDATA[GCalendar]]></category>
		<category><![CDATA[GData]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[googlecalendar]]></category>

		<guid isPermaLink="false">http://cornercases.67central.com/?p=7</guid>
		<description><![CDATA[A question from the for the Google Calendar Data API Developer Forum. Hi all, for (CalendarEventEntry event : calEventList) { for (Link link : event.getLinks()) { System.out.println(link.getHref()); } above code fragment prints three types of links, what these are meant for? What these links signify in the feed. &#8211; Regards, Vijay This is a question [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://groups.google.com/group/google-calendar-help-dataapi/browse_thread/thread/a9e11afdb73ee3dd">question</a> from the for the Google Calendar Data API <a href="http://groups.google.com/group/google-calendar-help-dataapi">Developer Forum</a>.</p>
<blockquote><p>Hi all, </p>
<pre><code>
for (CalendarEventEntry event : calEventList) {
    for (Link link : event.getLinks()) {
        System.out.println(link.getHref());
}
</code></pre>
<p>above code fragment prints three types of links, what these are meant for?<br />
What these links signify in the feed.<br />
&#8211;<br />
Regards,<br />
Vijay
</p></blockquote>
<p>This is a question that I had been meaning to address, but I was planning to get to it after I addressed all the different urls that are used in the GCalendar API. Actually this question is easier and more straight-forward to answer, so it makes sense to  answer this first. I&#8217;ll defer the larger questions of GCalendar event feeds and generic Atom feeds for a later post.</p>
<p>Here&#8217;s a complete entry feed (as formated with <code>tidy -xml -indent</code>):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">'1.0'</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">'utf-8'</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">'http://www.w3.org/2005/Atom'</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns:batch</span>=<span style="color: #ff0000;">'http://schemas.google.com/gdata/batch'</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns:gCal</span>=<span style="color: #ff0000;">'http://schemas.google.com/gCal/2005'</span></span>
<span style="color: #009900;"><span style="color: #000066;">xmlns:gd</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  http://www.google.com/calendar/feeds/td3s32e6k1ib7pkgibi7v6jktg%40group.calendar.google.com/private/full/g0pdsjl18em9tcdau6baqgatkk<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-04-21T22:36:07.000Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/published<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>2008-04-21T22:36:07.000Z<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/updated<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">scheme</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#kind'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">term</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;title</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Tennis with Beth<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;content</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Meet for a quick lesson.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/content<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'alternate'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text/html'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/event?eid=ZzBwZHNqbDE4ZW05dGNkYXU2YmFxZ2F0a2sgdGQzczMyZTZrMWliN3BrZ2liaTd2NmprdGdAZw'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">title</span>=<span style="color: #ff0000;">'alternate'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'self'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;"> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/td3s32e6k1ib7pkgibi7v6jktg%40group.calendar.google.com/private/full/g0pdsjl18em9tcdau6baqgatkk'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'edit'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span>  <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/td3s32e6k1ib7pkgibi7v6jktg%40group.calendar.google.com/private/full/g0pdsjl18em9tcdau6baqgatkk/63344500567'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Ray Baxter<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;email<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>me@gmail.com<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/email<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/author<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:comments<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:feedLink</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/td3s32e6k1ib7pkgibi7v6jktg%40group.calendar.google.com/private/full/g0pdsjl18em9tcdau6baqgatkk/comments'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/gd:comments<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:eventStatus</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.confirmed'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:visibility</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.default'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:transparency</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.opaque'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:uid</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'g0pdsjl18em9tcdau6baqgatkk@google.com'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gCal:sequence</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">'0'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:when</span> <span style="color: #000066;">startTime</span>=<span style="color: #ff0000;">'2008-04-17T08:00:00.000-07:00'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">endTime</span>=<span style="color: #ff0000;">'2008-04-17T10:00:00.000-07:00'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:who</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'http://schemas.google.com/g/2005#event.organizer'</span></span>
<span style="color: #009900;">  <span style="color: #000066;">valueString</span>=<span style="color: #ff0000;">''</span></span>
<span style="color: #009900;">  <span style="color: #000066;">email</span>=<span style="color: #ff0000;">'td3s32e6k1ib7pkgibi7v6jktg@group.calendar.google.com'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;gd:where</span> <span style="color: #000066;">valueString</span>=<span style="color: #ff0000;">'Rolling Lawn Courts'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Coming to Vijay&#8217;s question, there are three <code>
<link></code> elements in this feed. They are:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'alternate'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'text/html'</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/event?eid=ZzBwZHNqbDE4ZW05dGNkYXU2YmFxZ2F0a2sgdGQzczMyZTZrMWliN3BrZ2liaTd2NmprdGdAZw'</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">'alternate'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'self'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/td3s32e6k1ib7pkgibi7v6jktg%40group.calendar.google.com/private/full/g0pdsjl18em9tcdau6baqgatkk'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'edit'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/td3s32e6k1ib7pkgibi7v6jktg%40group.calendar.google.com/private/full/g0pdsjl18em9tcdau6baqgatkk/63344500567'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>The links are named for their relations, i.e. the values of their <code>rel</code> attributes.</p>
<p>The first link is the alternate link, so called because it is an alternative version of the content of this event. In this case the alternate version in html format as you can see by the <code>type='text/html'</code> attribute. Because this calendar is public, you can click on that link and see the event in your browser. <a target="_blank" href="http://www.google.com/calendar/event?eid=ZzBwZHNqbDE4ZW05dGNkYXU2YmFxZ2F0a2sgdGQzczMyZTZrMWliN3BrZ2liaTd2NmprdGdAZw" onclick="link_popup(this); return false">Try it</a>. </p>
<p>The second link is a self link. That is the the xml feed for this event, and can repull the event from this feed (in the event that Google&#8217;s servers are working, which they don&#8217;t appear to be currently.) Notice that the http attribute of the self link is exactly the same URL as the <code><id></code>.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
http://www.google.com/calendar/feeds/td3s32e6k1ib7pkgibi7v6jktg%40group.calendar.google.com/private/full/g0pdsjl18em9tcdau6baqgatkk<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/id<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;link</span> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">'self'</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">'application/atom+xml'</span></span>
<span style="color: #009900;"> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'http://www.google.com/calendar/feeds/td3s32e6k1ib7pkgibi7v6jktg%40group.calendar.google.com/private/full/g0pdsjl18em9tcdau6baqgatkk'</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>The self link may not have been the location from <em>you</em> pulled the event. You might have pulled an entire calendar of events (which would have it&#8217;s own, distinct, self link) or you might have made a query for events matching some pattern and retrieved a number of events for that feed (which would ought have it&#8217;s own self link, but I haven&#8217;t verified).</p>
<p>Finally there is the edit link. This is the URL that you use to make changes to the event. Sending a DELETE request to this URL will delete the event. Sending a PUT request will replace event&#8217;s data with the data that you send.</p>
<p>For reference, the self and alternate link relations are specified as part of the Atom Syndication Format (<a href="http://www.rfc-editor.org/rfc/rfc4287.txt">RFC4287</a>) and the edit relation is specified as part of the Atom Publication Protocol (<a href="http://www.rfc-editor.org/rfc/rfc5023.txt">RFC5023</a>). A convenient table of all the Atom link relations is <a href="http://www.iana.org/assignments/link-relations.html">here</a>. That table will come in handy as we examine the other link relations in GCalendar feeds.</p>
<hr />
Any other questions? Leave them in the comments and I&#8217;ll get to them as I can.</p>
]]></content:encoded>
			<wfw:commentRss>http://67central.com/bc/2008/04/27/link-elements-in-gcalendar-feeds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

