Protocols

WebDAV

Edit the files in your Yatta storage from any WebDAV client: Finder, Windows Explorer, or a command line tool. No extra setup.

WebDAV is file access over plain HTTP. Your Yatta server already serves it on /dav, backed by the same storage engine as uploads. Files you put there are the same files the storage engine sees.

Upload and download

PUT stores a file. The first PUT answers 201; putting the same path again overwrites it and answers 204.

PUT and GETts
# Upload a file — 201 the first time, 204 on overwritecurl -X PUT --data-binary @report.pdf http://localhost:4000/dav/report.pdf # Download it backcurl http://localhost:4000/dav/report.pdf -o report.pdf # Just the headers, no bodycurl -I http://localhost:4000/dav/report.pdf

GET on a folder does not return XML. It returns a plain text list, one path per line, with a trailing slash on folders — and (empty) when there is nothing in it.

List a folder with GETts
curl http://localhost:4000/dav/docs/ # Answerreport.pdfnotes/# (empty) if the folder has nothing in it

Make folders, move, copy

MKCOL makes one folder. Its parent must already exist, or you get a 409.

Folders and movests
# Make a folder — 201curl -X MKCOL http://localhost:4000/dav/docs # Move a file into it — 201 (or 204 if it overwrites)curl -X MOVE \  -H "Destination: http://localhost:4000/dav/docs/report.pdf" \  http://localhost:4000/dav/report.pdf # Copy instead of moving — the source stays putcurl -X COPY \  -H "Destination: http://localhost:4000/dav/docs/report-copy.pdf" \  http://localhost:4000/dav/report.pdf # Delete a file or an empty folder — 204curl -X DELETE http://localhost:4000/dav/docs/report-copy.pdf
Note
The Destination must be a full URL on this same server, under /dav. A destination on another host, or outside /dav, is refused with a 400. A destination that already exists is refused with a 412 — there is no overwrite flag. And a destination inside the source itself is refused with a 400.

List with PROPFIND

PROPFIND returns XML, not a plain list. Depth 0 describes just the path you asked about; Depth 1 adds its children. Send one of those two — leaving Depth out answers 403.

PROPFIND, Depth 1ts
curl -X PROPFIND -H "Depth: 1" http://localhost:4000/dav/docs/ # Answer (shortened) — 207 Multi-Status<D:multistatus xmlns:D="DAV:">  <D:response>    <D:href>/dav/docs/</D:href>    <D:propstat><D:prop>      <D:displayname>docs</D:displayname>      <D:resourcetype><D:collection/></D:resourcetype>    </D:prop></D:propstat>  </D:response>  <D:response>    <D:href>/dav/docs/report.pdf</D:href>    <D:propstat><D:prop>      <D:displayname>report.pdf</D:displayname>      <D:resourcetype/>      <D:getcontentlength>18204</D:getcontentlength>    </D:prop></D:propstat>  </D:response></D:multistatus>

Properties on every entry

displayname
The file or folder name.
resourcetype
Contains collection for folders, empty for files.
getcontentlength
File size in bytes. Files only.

Lock a file

LOCK takes an exclusive write lock. Other writes to that path are then refused with a 423 until you unlock it or show the token. A lock on a folder covers everything under it.

Lock, write, unlockts
# Lock — the answer carries the token in the Lock-Token headercurl -X LOCK -H "Content-Type: application/xml" \  --data '<D:lockinfo xmlns:D="DAV:"><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype><D:owner>ada</D:owner></D:lockinfo>' \  http://localhost:4000/dav/report.pdf# Lock-Token: <opaquelocktoken:abc123> # Write without the token — 423 Lockedcurl -X PUT --data-binary @new.pdf http://localhost:4000/dav/report.pdf # Write with the token — goes throughcurl -X PUT -H "Lock-Token: <opaquelocktoken:abc123>" \  --data-binary @new.pdf http://localhost:4000/dav/report.pdf # Unlock — 204 (a wrong token gets 409)curl -X UNLOCK -H "Lock-Token: <opaquelocktoken:abc123>" \  http://localhost:4000/dav/report.pdf

A lock lasts until you unlock it, or until the Timeout you asked for runs out. Ask with a Timeout header in seconds — the longest it can be is 24 hours.

Methods

OPTIONS
Answers Dav: 1, 2 plus the Allow list.
GET
Download a file, or list a folder as plain text.
HEAD
Same as GET, with no body.
PUT
Store a file. 201 new, 204 overwrite. 409 if the parent folder is missing, 405 on a folder.
MKCOL
Make a folder. 201. 415 if you send a body, 409 if the parent is missing, 405 if it already exists.
DELETE
Delete a file or folder. 204. Refused with 423 while anything inside is locked.
MOVE / COPY
Move or copy to a Destination URL. 201 new, 204 overwrite, 412 if the destination exists.
LOCK
Exclusive write lock. Returns the token in the Lock-Token header.
UNLOCK
Release a lock. 204. 409 if the token does not match.
PROPFIND
XML listing. Depth 0 or 1 only; anything else is 403. Answers 207.
Note
The root collection itself cannot be deleted, moved, or copied — those answer 403. Deleting or moving a folder is refused with 423 while anything inside it is locked.
Warning
WebDAV has no login of its own. On a public server, only expose /dav behind a proxy or middleware that checks who the caller is.