wiki:useful/debugCalDav

CalDAV

Potentially useful commands to debug a CalDAV server

Get a list of calendars for a user

save the following as mycals.xml:

<?xml version="1.0" encoding="utf-8" ?> 
<D:propfind xmlns:D="DAV:">
        <D:prop>
                <D:displayname/>
        </D:prop> 
</D:propfind>
(NOTE: we are using Depth: 1 to list all subitems)
$ curl -v --user '{username}' --digest -X "PROPFIND" --data "@mycals.xml" -H "Accept:" \
-H "Content-Type: text/xml; charset=utf-8" -H "Depth: 1" -H "Connection: close" \
http://{calserver.com}:8008/calendars/users/{username}/
Enter host password for user 'username': {password}
<Output Snipped>
<?xml version='1.0' encoding='UTF-8'?><multistatus xmlns='DAV:'>
<Output Snipped>
  <response>
    <href>/calendars/users/{username}/FCCE8480-F370-44E9-B4AC-BCF4F762C23F/</href>
    <propstat>
      <prop>
        <displayname>Important Dates</displayname>
      </prop>
      <status>HTTP/1.1 200 OK</status>
    </propstat>
  </response>
<Output Snipped>

Create a file called calrequest.xml with the following information

<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:" xmlns:CS="http://calendarserver.org/ns/" xmlns:C="urn:ietf:params:xml:ns:caldav">
  <D:prop>
    <D:resourcetype/>
    <D:owner/>
    <D:supported-report-set/>
    <C:supported-calendar-component-set/>
    <CS:getctag/>
  </D:prop>
</D:propfind>
(Request properties of a specific calendar, passing in the xml in calrequest.txt)
(note we are setting Depth: 0 so that we only get info about this calendar)
(calendar-id can be found by performing the step listed previously)

$ curl -i --user '{username}' --digest -X "PROPFIND" --data "@calrequest.xml" -H "Accept:" \
-H "Content-Type: text/xml; charset=utf-8" -H "Depth: 0" \
http://{calserver.com}:8008/calendars/users/{username}/{calendar-id}/
Enter host password for user 'username': {password}
<Output Snipped>
<?xml version='1.0' encoding='UTF-8'?><multistatus xmlns='DAV:'>
  <response>
    <href>/calendars/users/username/FCCE8480-F370-44E9-B4AC-BCF4F762C23F/</href>
    <propstat>
      <prop>
        <resourcetype>
          <collection/>
          <calendar xmlns='urn:ietf:params:xml:ns:caldav'/>
        </resourcetype>
        <owner>
          <href>/principals/__uids__/3CB5EBA0-A27B-4D8D-85C4-8B82E1A4BA8F/</href>
        </owner>
        <supported-report-set>
<Output Snipped>
          </supported-report>
        </supported-report-set>
        <supported-calendar-component-set xmlns='urn:ietf:params:xml:ns:caldav'>
          <comp name='VEVENT'/>
          <comp name='VTODO'/>
          <comp name='VTIMEZONE'/>
          <comp name='VJOURNAL'/>
          <comp name='VFREEBUSY'/>
        </supported-calendar-component-set>
        <getctag xmlns='http://calendarserver.org/ns/'>2010-06-07 10:22:47.208180</getctag>
        <displayname>Important Dates</displayname>
      </prop>
      <status>HTTP/1.1 200 OK</status>
    </propstat>
  </response>
</multistatus>