Skip to end of metadata
Go to start of metadata

Sometimes reverse-engineering is easier than reading the documentation.

My eyes were starting to glaze over from all the RFCs and Zimbra documents, when I realized that I've got a CalDAV server (ZCS 5.0) and I've got a CalDAV client (Apple iCal 3.0.2), so all I have to do is listen to the HTTP traffic between them and I can see immediately what happens, and when.

So I've studied a few conversations. When iCal wants to push a new event into Zimbra, it does an HTTP PUT with these contents:

header name

header value

User-Agent

DAVKit/2.0 (10.5.2; wrbt) iCal 3.0.2

Host

192.168.1.109

Authorization

Basic emFjaDpv6uivccn2lZa==

If-Match

"524-1208550558000"

Content-Type

text/calendar

Content-Length

686

Connection

close

PUT request
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Apple Inc.//iCal 3.0//EN
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:US/Central
BEGIN:DAYLIGHT
TZOFFSETFROM:-0600
TZOFFSETTO:-0500
DTSTART:20070311T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
TZNAME:CDT
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0500
TZOFFSETTO:-0600
DTSTART:20071104T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
TZNAME:CST
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
SEQUENCE:2
TRANSP:OPAQUE
UID:B04F5D23-CEDB-4553-A2B4-ABD387414DEF
DTSTART;TZID=US/Central:20080501T160000
DTSTAMP:20080418T202919Z
SUMMARY:movie nite
CREATED:20080418T202916Z
DTEND;TZID=US/Central:20080501T170000
END:VEVENT
END:VCALENDAR

The iCalendar format is not much fun to read, but it's not impenetrable, and there's at least one Java library for handling it that appears to have a Sakai-friendly license: http://m2.modularity.net.au/projects/ical4j/

And here's a delete operation. It's an HTTP DELETE. The request doesn't even need a body:

header name

header value

User-Agent

DAVKit/2.0 (10.5.2; wrbt) iCal 3.0.2

Host

192.168.1.109

Authorization

Basic emFjaDpv6uivccn2lZa==

If-Match

"524-1208550560000"

Content-Length

0

Connection

close

I already have some Java code (not ready to commit) that creates requests just like these. Isn't it kind of awesome how well HTTP works? Next time, I'll wax poetic about etags.

  • No labels