WebDAV headers and body - OpenMarshal/npm-WebDAV-Server GitHub Wiki
Body
Here are, for each WebDAV method, the type of content of the request and the response.
Method | Request | Response |
---|---|---|
Proppatch |
XML | XML / JSON |
Propfind |
- / XML / JSON | XML / JSON |
Options |
- | - |
Delete |
- | - |
Unlock |
- | - |
Mkcol |
- | - |
Copy |
- | - |
Lock |
XML / JSON | XML / JSON |
Move |
- | - |
Head |
- | - |
Post |
- / * | - |
Put |
- / * | - |
Get |
- | * |
* Whatever (binary, text, ...)
The type of the content in the response can be switcher from the default XML type to the JSON thanks to the HTTP Accept
header.
The JSON is formatted by xml-js. The request body supports compact and non-compact JSON. The response body is compact JSON.
Headers
Here are the headers used in the default implementation of the server :
Header | Method | Description | Example |
---|---|---|---|
Accept | all | Define a list of accepted content types. | Accept: application/json, application/xml |
Source | GET HEAD POST PUT PROPFIND |
Define if the source of the resource must be targeted (value = T | F). | Source: T |
Translate | GET HEAD POST PUT PROPFIND |
It is the opposite of the Source header. |
|
Destination | MOVE* COPY* |
Define the destination of the operation. | Destination: http://webdavserver.com/destFolder/destFile |
Lock-Token | LOCK response* UNLOCK* |
Define the UUID of the new lock or of the lock to remove. | Lock-Token: <urn:uuid:a515cfa4-5da4-22e1-f5bf-00a0451e6bf7> |
If | all LOCK refresh* |
Define a condition (for a full description, refer to the RFC4918 - Header If). | If: (<urn:uuid:a515cfa4-5da4-22e1-f5bf-00a0451e6bf7>) |
Overwrite | MOVE COPY |
Define if the operation can overwrite the destination resource if it already exists (value = T | F). | Overwrite: T |
Depth | PROPFIND |
Define the depth of the operation (Value = 0 | 1 | Infinity). | Depth: 0 |
Host | all* | Define the host used for the request, allowing the server to produce absolute URL. | Host: webdavserver.com:1900 |
Content-Length | all* | Define the content length. If there is no content, the value must be 0. | Content-Length: 0 |
Authorization | all | Authenticate the user. | Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== |
* Required