I am currently digging around for a way to build a CardDAV server in PHP. This is for a small development that would hopefully allow my company to share contacts from/to many kinds of devices, served by a custom backend/CRM.
I've started playing around, trying to understand the protocol but ended up twice as confused. I then read the IETF drafts but found out I don't even understand the basics of WebDAV itself.
In which ways would you recommend that I start learning about CardDAV, WebDAV and everything related?
I am curious to see, if I can help resolve some confusion around webdav. Most IETF standards uses language that seems very obtuse.
Rationale behind WebDAV
HTTP was designed for fetching web resources or shall I say reading. It wasn't meant for authoring a web resource.
In short, WebDAV provides a full suite of remote document access capabilities, including file storage, directory management, and support for collaborative authoring.
Think of file system
The shortest route to understanding webdav is it's similarity of treating web resources like file system.
Just like folders, there are collections as special web resource that can contain other web resources. It needed to distinguish this as a special resource because capabilities (methods that would apply are different for a normal resource)
So new method was born - mkcol
Just like files have attributes, web resources have meta-properties which provides some details about the web resource. The web resource content itself can be rendered as before (HTTP already does that for you).
In short, you also need to have methods to enquire into meta-properties - PROPFIND and also change them - PROPATCH. The XML payloads were meant to enquire and retrieve these properties.
WebDAV's approach is to store properties outside the file body, can be queried without getting the entire body and updated without changing the body.
Some properties are webdav specific. They were created out of need. For ex: Resourcetype Property. It was created to enquire if you are taking to special collection resource or a normal web resource contained in a collection.
Remember that GET (Like HTTP) fetches a resource, PUT modifies a resource, and DELETE removes a resource.
Limitations of HTTP
To understand webdav, you have to understand the limitations of HTTP.
depth header was created so that you could tell if it need to work on all resources. WebDAV resource model
+--------+ +--------------+
|Resource|... |Property |
+--------+ +--------------+
+------++------+
|Webdav||custom|
+------++------+
+-----------+
|Dav root: /|......
+-----------+ | +--------+
|.....|Resource|
| +--------+
| +----------+
|.....|Collection|..... +----------+
' +----------+ |...|Collection|
| +----------+
| +--------+
|....|Resource|
+--------+
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With