1 http://sabre.io/dav/building-a-caldav-client/
6 Content-Type: application/xml; charset=utf-8
8 <d:propfind xmlns:d="DAV:">
10 <d:current-user-principal />
15 HTTP/1.1 207 Multi-status
16 Content-Type: application/xml; charset=utf-8
18 <d:multistatus xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/">
23 <d:current-user-principal>
24 <d:href>/principals/users/johndoe/</d:href>
25 </d:current-user-principal>
27 <d:status>HTTP/1.1 200 OK</d:status>
33 PROPFIND /principals/users/johndoe/ HTTP/1.1
35 Prefer: return-minimal
36 Content-Type: application/xml; charset=utf-8
38 <d:propfind xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
40 <c:calendar-home-set />
45 HTTP/1.1 207 Multi-status
46 Content-Type: application/xml; charset=utf-8
48 <d:multistatus xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
50 <d:href>/principals/users/johndoe/</d:href>
54 <d:href>/calendars/johndoe/</d:href>
55 </c:calendar-home-set>
57 <d:status>HTTP/1.1 200 OK</d:status>
63 PROPFIND /calendars/johndoe/ HTTP/1.1
65 Prefer: return-minimal
66 Content-Type: application/xml; charset=utf-8
68 <d:propfind xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/" xmlns:c="urn:ietf:params:xml:ns:caldav">
73 <c:supported-calendar-component-set />
78 HTTP/1.1 207 Multi-status
79 Content-Type: application/xml; charset=utf-8
81 <d:multistatus xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/" xmlns:c="urn:ietf:params:xml:ns:caldav">
83 <d:href>/calendars/johndoe/</d:href>
90 <d:status>HTTP/1.1 200 OK</d:status>
94 <d:href>/calendars/johndoe/home/</d:href>
101 <d:displayname>Home calendar</d:displayname>
102 <cs:getctag>3145</cs:getctag>
103 <c:supported-calendar-component-set>
104 <c:comp name="VEVENT" />
105 </c:supported-calendar-component-set>
107 <d:status>HTTP/1.1 200 OK</d:status>
111 <d:href>/calendars/johndoe/tasks/</d:href>
118 <d:displayname>My TODO list</d:displayname>
119 <cs:getctag>3345</cs:getctag>
120 <c:supported-calendar-component-set>
121 <c:comp name="VTODO" />
122 </c:supported-calendar-component-set>
124 <d:status>HTTP/1.1 200 OK</d:status>
129 1. Get display name and ctag
130 PROPFIND /calendars/johndoe/home/ HTTP/1.1
132 Prefer: return-minimal
133 Content-Type: application/xml; charset=utf-8
135 <d:propfind xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/">
143 HTTP/1.1 207 Multi-status
144 Content-Type: application/xml; charset=utf-8
146 <d:multistatus xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/">
148 <d:href>/calendars/johndoe/home/</d:href>
151 <d:displayname>Home calendar</d:displayname>
152 <cs:getctag>3145</cs:getctag>
154 <d:status>HTTP/1.1 200 OK</d:status>
160 HTTP/1.1 207 Multi-status
161 Content-Type: application/xml; charset=utf-8
163 <d:multistatus xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/">
165 <d:href>/calendars/johndoe/home/</d:href>
171 <d:status>HTTP/1.1 403 Forbidden</d:status>
176 2. Save display name and ctag (if ctag changes the calendar has changes)
179 REPORT /calendars/johndoe/home/ HTTP/1.1
181 Prefer: return-minimal
182 Content-Type: application/xml; charset=utf-8
184 <c:calendar-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
190 <c:comp-filter name="VCALENDAR" />
195 HTTP/1.1 207 Multi-status
196 Content-Type: application/xml; charset=utf-8
198 <d:multistatus xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/">
200 <d:href>/calendars/johndoe/home/132456762153245.ics</d:href>
203 <d:getetag>"2134-314"</d:getetag>
204 <c:calendar-data>BEGIN:VCALENDAR
209 SUMMARY:Do the dishes
215 <d:status>HTTP/1.1 200 OK</d:status>
219 <d:href>/calendars/johndoe/home/132456-34365.ics</d:href>
222 <d:getetag>"5467-323"</d:getetag>
223 <c:calendar-data>BEGIN:VCALENDAR
228 SUMMARY:Weekly meeting
229 DTSTART:20120101T120000
236 <d:status>HTTP/1.1 200 OK</d:status>
247 - Fetch ctag -> see 1.
248 - If ctag is changes fetch all etags
249 REPORT /calendars/johndoe/home/ HTTP/1.1
251 Prefer: return-minimal
252 Content-Type: application/xml; charset=utf-8
254 <c:calendar-query xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
259 <c:comp-filter name="VCALENDAR" />
264 HTTP/1.1 207 Multi-status
265 Content-Type: application/xml; charset=utf-8
267 <d:multistatus xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/">
269 <d:href>/calendars/johndoe/home/132456762153245.ics</d:href>
272 <d:getetag>"xxxx-xxx"</d:getetag>
274 <d:status>HTTP/1.1 200 OK</d:status>
278 <d:href>/calendars/johndoe/home/fancy-caldav-client-1234253678.ics</d:href>
281 <d:getetag>"5-12"</d:getetag>
283 <d:status>HTTP/1.1 200 OK</d:status>
288 Compare local url's to request:
289 if match compare etag. if etag compares continue else update.
290 delete each local url not found
291 fetch every url not found local
294 REPORT /calendars/johndoe/home/ HTTP/1.1
296 Prefer: return-minimal
297 Content-Type: application/xml; charset=utf-8
299 <c:calendar-multiget xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
304 <d:href>/calendars/johndoe/home/132456762153245.ics</d:href>
305 <d:href>/calendars/johndoe/home/fancy-caldav-client-1234253678.ics</d:href>
306 </c:calendar-multiget>
309 If-Match contains etag to update and You must not change the UID of the original object
310 PUT /calendars/johndoe/home/132456762153245.ics HTTP/1.1
311 Content-Type: text/calendar; charset=utf-8
319 HTTP/1.1 204 No Content
322 If no etag is returned make an immediate GET to get etag
325 PUT /calendars/johndoe/home/somerandomstring.ics HTTP/1.1
326 Content-Type: text/calendar; charset=utf-8
336 7. Deleting an object
337 DELETE /calendars/johndoe/home/132456762153245.ics HTTP/1.1