Connecting to a CalDAV Server with cURL

After installing Baikal as a CalDAV/CardDAV server, I tested the connectivity to this server with cURL. I used SSL with a self-signed certificate on the web server, authentification on the CalDAV server was set to DIGEST.

This is being reflected in the cURL request by using –insecure to address the self-signed certificate and –digest for the DIGEST authentification method, when requesting the username:

curl 
--request PROPFIND
--insecure
--digest
--user USERNAME:PASSWORD
--header "Content-Type: text/xml"
--header "Brief:t"
--data "<D:propfind xmlns:D='DAV:'><D:prop><D:displayname/></D:prop></D:propfind>"
https://example.com/path/to/cal.php/principals/USERNAME

USERNAME and PASSWORD are eponymous placeholders, the object in the URL path (cal.php/principals/USERNAME) is specific for Baikal server.

The result of this query:

<?xml version="1.0" encoding="utf-8"?>
<d:multistatus 
 xmlns:d="DAV:" 
 xmlns:s="http://sabredav.org/ns" 
 xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:cs="http://calendarserver.org/ns/"
>
 <d:response>
  <d:href>/path/to/cal.php/principals/USERNAME/</d:href>
  <d:propstat>
   <d:prop>
    <d:displayname>Ron Metten</d:displayname>
   </d:prop>
   <d:status>HTTP/1.1 200 OK</d:status>
  </d:propstat>
 </d:response>
</d:multistatus>