hivedav

A curlable free/busy scheduler with CalDAV integration
git clone https://git.in0rdr.ch/hivedav.git
Log | Files | Refs | Pull requests |Archive | README | LICENSE

CALDAV.md (2966B)


      1 # CalDav requests
      2 
      3 ## Request flow
      4 CalDav request flow is as follows:
      5 1. Get user principal
      6 2. Find home set of user principal
      7 3. Get calendar from home set
      8 4. Fetch all events from calendar and sync availability
      9 
     10 To debug the flow, use the xml snippets from the code and curl.
     11 
     12 ## Tested providers
     13 * GMX
     14   - example 1: `HIVEDAV_CALDAV_HOST=https://caldav.gmx.net` and
     15     `HIVEDAV_CALENDAR=1`
     16   - example 2:
     17     `HIVEDAV_CALDAV_URI=https://caldav.gmx.net/begenda/dav/$PRINCIPAL/calendar`
     18   - https://hilfe.gmx.net/kalender/mobil/apps.html
     19 * Yahoo
     20   - create app password for `HIVEDAV_CALDAV_PASSWORD` at
     21     https://login.yahoo.com/myaccount/security/app-password
     22   - example 1: `HIVEDAV_CALDAV_HOST=https://caldav.calendar.yahoo.com` and
     23     `HIVEDAV_CALENDAR=1`
     24   - example 2:
     25     `HIVEDAV_CALDAV_URI=https://caldav.calendar.yahoo.com/dav/$PRINCIPAL/Calendar/$CALENDAR_ID`
     26   - https://help.yahoo.com/kb/SLN4707.html
     27 * Kopano (with calendar discovery, use `HIVEDAV_CALDAV_HOST`)
     28   - example: `HIVEDAV_CALDAV_HOST=https://mail.server.com:8443`
     29   - https://documentation.kopano.io/user_manual_kopanocore/configure_caldav_clients.html
     30 
     31 If you are unsure on how to retrieve the `HIVEDAV_CALDAV_URI` for a specific
     32 provider, follow the example flow below to manually discover a particular
     33 calendar CalDav uri.
     34 
     35 ## Generic flow example
     36 These curl commands depict the request flow from the Go code and should work
     37 with any provider.
     38 
     39 First, read the principal:
     40 ```
     41 cat <<EOF | curl -s -d @- -XPROPFIND -H "Content-Type: text/xml" -H "Depth: 0" \
     42   -u '$USER:$PASSWORD' -L $CALDAV_HOST | xmllint --format -
     43 <d:propfind xmlns:d="DAV:">
     44  <d:prop>
     45   <d:current-user-principal />
     46  </d:prop>
     47 </d:propfind>
     48 EOF
     49 ```
     50 The principal path (`$PRINCIPAL`) is returned in the XML response tag
     51 `<DAV:current-user-principal>`. For some providers, `$CALDAV_HOST` has a
     52 special prefix (such as `/begenda/dav/users` for GMX, follow the 302 redirect
     53 location with curl).
     54 
     55 Get calendar home set for the principal:
     56 ```
     57 cat <<EOF | curl -s -d @- -XPROPFIND -H "Content-Type: text/xml" -H "Depth: 0" \
     58   -u '$USER:$PASSWORD' $CALDAV_HOST/$PRINCIPAL | xmllint --format -
     59 <d:propfind xmlns:d="DAV:" xmlns:c="urn:ietf:params:xml:ns:caldav">
     60  <d:prop>
     61   <c:calendar-home-set />
     62  </d:prop>
     63 </d:propfind>
     64 EOF
     65 ```
     66 
     67 The users calendar home set `$HOME_SET` is returned in the
     68 `<calendar-home-set>` XML tag.
     69 
     70 This home set contains all calendars of the user. Finally, to list the
     71 calendars (`HIVEDAV_CALDAV_URI`):
     72 ```
     73 cat <<EOF | curl -s -d @- -XPROPFIND -H "Content-Type: text/xml" -H "Depth: 1" \
     74   -u '$USER:$PASSWORD' $CALDAV_HOST/$HOME_SET | xmllint --format -
     75 <d:propfind xmlns:d="DAV:" xmlns:cs="http://calendarserver.org/ns/" xmlns:c="urn:ietf:params:xml:ns:caldav">
     76  <d:prop>
     77   <d:resourcetype />
     78   <d:displayname />
     79   <cs:getctag />
     80   <c:supported-calendar-component-set />
     81  </d:prop>
     82 </d:propfind>
     83 EOF
     84 ```
     85 
     86 Choose a calendar CalDav URI (`HIVEDAV_CALDAV_URI`) to sync with a particular
     87 calendar.