3. CalDAV?
CalDAV aka RFC4791 was created to provide a standard
protocol for store and retrieve events.
It's implemented by:
Google,
Apple,
Oracle
Bedework (Rensealer Politechnic Institute)
OSAF (OpenSource Apps Foundation)
Zimbra
4. CalDAV
It is based on WebDAV, an extension of HTTP.
Inherites HTTP advantages
Support access control thru WebDAV ACL
Has methods for query events
Use ETAGS to speed sync
5. Storing and getting
Events are stored in files and folders.
Files are named Resource.
Each resource has a unique uid,
that's usually the resource name
6. Storing and Getting
• Basic actions/method
METHOD ACTIONS
GET Retrieve an event
PUT Put an event on server
DEL Remove event or collection (folder) from server
HEAD Check existence / Get ETAG for a given event
REPORT Query for events by UID, LOCATION,
SUMMARY...
PROPFIND Check resource property, permissions...
ACL Set acl
OPTIONS Check which actions can be made on a resource
7. Storing and getting - GET
• GET
– Retrieves an event GET /user/calendar/myevent.ics
– Returns the ETAG too (eg. “123124321524-1”)
– ETAG is a string used for versioning the event: when
myevent.ics changes, the ETAG is modified
• HEAD
– Retrieves the ETAG only, or an error if event is not
found
8. Storing and getting - PUT
• PUT
– Used for creating and update
– Put an event PUT
/user/calendar/myevent.ics
– Returns the ETAG too (eg.
“123124321524-2”)
– Thru ETAG is possible to change PUT
behaviour (create or update)
9. Storing and getting – PUT 2
• PUT
comando header azione errori
PUT If-none-matches: * Crea la risorsa Se una risorsa esiste con lo
/user/myfile.ics specificata se stesso nome, viene restituito
nessun'altra risorsa è l'errore PRECONDITION
presente a FAILED, poiché if-none-
quell'indirizzo, usato matches indica che la pre-
per creare una nuova condizione per fare il PUT è
risorsa sul server. che nessuna risorsa
corrisponda a quella che
vogliamo creare
PUT If-matches: Invia la risorsa PRECONDITION FAILED
/user/myfile.ics “12312312-1” specificata viene restituito se la risorsa
solamente se è già non esiste. Infatti potrebbe
presente una risorsa accadere che il file che
allo stesso indirizzo, vogliamo aggiornare sia
e la versione di tale cambiato sul server e sia
risorsa ha ETAG diverso da quello che ci
“12312312-1” aspettiamo
10. Storing and getting - DEL
• DEL
– Removes a resource (event or collection)
from server
– DEL /user/calendar/myevent.ics
• MKCALENDAR
– Create a calendar collection (folder) on
server
11. Querying - REPORT
• REPORT
– Used for querying events in a collection
– eg. REPORT /user/calendar/
– REPORT body is an XML query describing
the events we are looking for
• By UID, LOCATION, DESCRIPTION,..
• By time-range (events starting/ending)
within a given time-frame
12. Querying - REPORT
Filter events
HTTP header
REPORT /bernard/work/ HTTP/1.1 <C:filter>
Host: cal.example.com Get <C:comp-filter name="VCALENDAR">
Depth: 1
Content-Type: application/xml; charset="utf-8" We're making a VCALENDARs <C:comp-filter name="VEVENT">
Content-Length: xxxx query. <prop> containing
<C:time-range start="20060104T000000Z"
VEVENTs
describes data that START/END end="20060105T000000Z"/>
we're asking at between
<?xml version="1.0" encoding="utf-8" ?> </C:comp-filter>
server 04.01.06
<C:calendar-query xmlns:D="DAV:" and
</C:comp-filter>
05.01.06
xmlns:C="urn:ietf:params:xml:ns:caldav"> </C:filter>
<D:prop>
</C:calendar-query>
<D:getetag/>
<C:calendar-data>
<C:comp name="VCALENDAR">
Describe data we
<C:prop name="VERSION"/>
want to retrieve:
<C:comp name="VEVENT">
BEGIN:VCALENDAR
<C:prop name="SUMMARY"/> VERSION:2.0
BEGIN:VEVENT
<C:prop name="UID"/> UID:XXXX
</C:comp> SUMMARY:XXXX
BEGIN:VTIMEZONE
<C:comp name="VTIMEZONE"/> ...
END:VTIMEZONE
</C:comp>
</C:calendar-data>
</D:prop>
13. Sharing - ACL
• PROPFIND method provides a way to get
ACLs from a calendar resource / collection
• ACLs are defined as in WebDAV with some
CalDAV specific permissions A “user” principal is defined by an
http URL provided by the server
Query Description XML representation
PROPFIND /caluser1/calendar/ Query for ACL defined <acl>
<D:propfind xmlns:D="DAV:"> <ace>
<D:prop> <principal> <property> <owner/> </property> </principal>
<D:acl/> <grant> <all/> </grant>
</D:prop> <inherited> <href>/user</href> </inherited> This ACL is inherited by upper
A principal is a special entity
</D:propfind> defined on server. It can be a user,
</ace> folder /user
a group or a “property” defined on <ace>
server. In this case we use the <principal><href>/ucaldav/principals/users/caluser1</href></principal>
“owner” property defined on the <grant> <all/> </grant>
server </ace>
<ace>
<principal> <authenticated/> </principal>
<grant> <ns1:read-free-busy/> <ns1:schedule/> </grant>
These privileges are CalDAV <inherited> <href>/user</href> </inherited>
specific: allows </ace>
•to see free-busy of given user </acl>
•to invite him to a meeting