Simulators
Paths and conflicts
A write that conflicts with an existing entry returns 409 with the conflict in error_summary, and so does each write the last table names, at the path its row gives. Use these refusals to test a client’s conflict handling. Boot the simulator as in the Quickstart, then upload other bytes over an existing file:
H='Authorization: Bearer sl.placeholder'
J='Content-Type: application/json'
O='Content-Type: application/octet-stream'
curl -s "$RYSTIC_URL/2/files/upload" -H "$H" -H "$O" -H 'Dropbox-API-Arg: {"path":"/notes.md","mode":"add"}' --data-binary 'other' | jq -c .error_summary
# -> "path/conflict/file/..."
Upload over an existing file
An upload to a path that holds a file returns, by its mode and bytes:
mode | Other bytes | The bytes the file holds |
|---|---|---|
add, the default | 409 path/conflict/file | 200 and the file unchanged; with strict_conflict: true, 409 path/conflict/file |
overwrite, or update naming the file’s rev | 200 and the file replaced | 200 and the file unchanged |
update naming another rev | 409 path/conflict/file | 409 path/conflict/file |
With autorename: true, an upload the table refuses lands under the first free name instead. Try each case:
curl -s "$RYSTIC_URL/2/files/upload" -H "$H" -H "$O" -H 'Dropbox-API-Arg: {"path":"/notes.md","mode":"add","autorename":true}' --data-binary 'other' | jq -c '{name}'
# -> {"name":"notes (1).md"}
REV=$(curl -s "$RYSTIC_URL/2/files/upload" -H "$H" -H "$O" -H 'Dropbox-API-Arg: {"path":"/draft.txt","mode":"add"}' --data-binary 'v1' | jq -r .rev)
curl -s "$RYSTIC_URL/2/files/upload" -H "$H" -H "$O" -H 'Dropbox-API-Arg: {"path":"/draft.txt","mode":"add"}' --data-binary 'v1' | jq -c --arg r "$REV" '{name, unchanged: (.rev == $r)}'
# -> {"name":"draft.txt","unchanged":true}
curl -s "$RYSTIC_URL/2/files/upload" -H "$H" -H "$O" -H 'Dropbox-API-Arg: {"path":"/draft.txt","mode":"add","strict_conflict":true}' --data-binary 'v1' | jq -c .error_summary
# -> "path/conflict/file/..."
curl -s "$RYSTIC_URL/2/files/upload" -H "$H" -H "$O" -H 'Dropbox-API-Arg: {"path":"/draft.txt","mode":"overwrite"}' --data-binary 'v2' | jq -c --arg r "$REV" '{name, replaced: (.rev != $r)}'
# -> {"name":"draft.txt","replaced":true}
curl -s "$RYSTIC_URL/2/files/upload" -H "$H" -H "$O" -H 'Dropbox-API-Arg: {"path":"/draft.txt","mode":{".tag":"update","update":"'"$REV"'"}}' --data-binary 'v3' | jq -c .error_summary
# -> "path/conflict/file/..."
Write beneath a file or to a path ending in a slash
curl -s "$RYSTIC_URL/2/files/create_folder_v2" -H "$H" -H "$J" -d '{"path":"/notes.md/drafts"}' | jq -c .error_summary
# -> "path/conflict/file_ancestor/..."
curl -s "$RYSTIC_URL/2/files/create_folder_v2" -H "$H" -H "$J" -d '{"path":"/Reports/"}' | jq -c .error_summary
# -> "path/malformed_path/..."
Which writes refuse which path
| Path | Refused by | Error |
|---|---|---|
| beneath a file | restore, an upload, an upload-session finish, create_folder_v2, move_v2, copy_v2 and each entry of a batch move or copy | conflict/file_ancestor |
/ or one ending in / | save_url and the same writes apart from restore | malformed_path |
file_requests/create accepts either path as its destination, and save_url accepts a path beneath a file (unconfirmed).
Last updated on