Skip to Content
SimulatorsDropboxDeleted files and revisions

Simulators

Deleted files and revisions

A deleted file leaves a tombstone and its revisions behind, and any revision restores. Boot the simulator as in the Quickstart, upload a file twice, delete it and bring the oldest revision back:

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":"/draft.txt","mode":"add"}' --data-binary 'v1' | jq -c '{name, size}'
# -> {"name":"draft.txt","size":2}
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 '{name, size}'
# -> {"name":"draft.txt","size":2}
curl -s "$RYSTIC_URL/2/files/delete_v2" -H "$H" -H "$J" -d '{"path":"/draft.txt"}' | jq -c '.metadata.name'
# -> "draft.txt"
curl -s "$RYSTIC_URL/2/files/get_metadata" -H "$H" -H "$J" -d '{"path":"/draft.txt","include_deleted":true}' | jq -c .
# -> {".tag":"deleted","name":"draft.txt","path_display":"/draft.txt","path_lower":"/draft.txt"}
curl -s "$RYSTIC_URL/2/files/list_revisions" -H "$H" -H "$J" -d '{"path":"/draft.txt"}' | jq -c '{is_deleted, revisions: (.entries | length)}'
# -> {"is_deleted":true,"revisions":2}
REV=$(curl -s "$RYSTIC_URL/2/files/list_revisions" -H "$H" -H "$J" -d '{"path":"/draft.txt"}' | jq -r '.entries[-1].rev')
curl -s "$RYSTIC_URL/2/files/restore" -H "$H" -H "$J" -d "{\"path\":\"/draft.txt\",\"rev\":\"$REV\"}" | jq -c '{name, size}'
# -> {"name":"draft.txt","size":2}
curl -s "$RYSTIC_URL/2/files/download" -H "$H" -H 'Dropbox-API-Arg: {"path":"/draft.txt"}'
# -> v1

Tombstones

delete_v2 is a soft delete: the entry no longer reads back by path, and downloading it returns 409 path/not_found. With include_deleted: true, two routes still return it as a tombstone:

RouteReturns
list_folderthe tombstone among the folder’s entries
get_metadataDeletedMetadata: .tag, name, path_lower and path_display

A deleted folder is a tombstone too.

Revisions

Every upload, session finish, restore and move of a file records its own rev. A deleted file is still a file to files/list_revisions, which returns its revisions with is_deleted: true. Any of them restores through files/restore, as a new revision with that revision’s bytes. list_revisions in id mode lists a file’s revisions across renames, and mode takes the bare tag ("id") as well as {".tag": "id"}.

The dropbox_deleted_backlog scenario boots with four deleted files, each with its revision listed and ready to restore, and one deleted folder:

  • /Archive/old-budget.xlsx
  • /Archive/old-budget-v2.xlsx
  • /Drafts/pitch-draft.key
  • /Drafts/pitch-final.key
  • the folder /Archive/retired
Last updated on