Skip to Content
SimulatorsDropboxShared links and file requests

Simulators

Shared links and file requests

A shared link points at a file or folder, and a file request opens a destination folder to uploads from people without an account. Boot the simulator as in the Quickstart, then share a file, read the link back and revoke it:

H='Authorization: Bearer sl.placeholder'
J='Content-Type: application/json'
curl -s "$RYSTIC_URL/2/sharing/create_shared_link_with_settings" -H "$H" -H "$J" -d '{"path":"/notes.md"}' | jq -c '{url, name, visibility: .link_permissions.resolved_visibility[".tag"]}'
# -> {"url":"https://www.dropbox.com/s/000000000000001/notes.md?dl=0","name":"notes.md","visibility":"public"}
U=$(curl -s "$RYSTIC_URL/2/sharing/list_shared_links" -H "$H" -H "$J" -d '{"path":"/notes.md"}' | jq -r '.links[0].url')
curl -s "$RYSTIC_URL/2/sharing/get_shared_link_metadata" -H "$H" -H "$J" -d "{\"url\":\"$U\"}" | jq -c '{name, size}'
# -> {"name":"notes.md","size":1794}
curl -s "$RYSTIC_URL/2/sharing/revoke_shared_link" -H "$H" -H "$J" -d "{\"url\":\"$U\"}"
# -> null
curl -s "$RYSTIC_URL/2/sharing/get_shared_link_metadata" -H "$H" -H "$J" -d "{\"url\":\"$U\"}"
# -> {"error":{".tag":"shared_link_not_found"},"error_summary":"shared_link_not_found/."}

File requests follow their own lifecycle: create one, then close it before you delete it:

curl -s "$RYSTIC_URL/2/file_requests/create" -H "$H" -H "$J" -d '{"title":"Receipts","destination":"/Documents"}' | jq -c '{title, destination, is_open, file_count}'
# -> {"title":"Receipts","destination":"/Documents","is_open":true,"file_count":0}
ID=$(curl -s "$RYSTIC_URL/2/file_requests/list_v2" -H "$H" -H "$J" -d '{}' | jq -r '.file_requests[0].id')
curl -s "$RYSTIC_URL/2/file_requests/delete" -H "$H" -H "$J" -d "{\"ids\":[\"$ID\"]}"
# -> {"error":{".tag":"file_request_open"},"error_summary":"file_request_open/..."}
curl -s "$RYSTIC_URL/2/file_requests/update" -H "$H" -H "$J" -d "{\"id\":\"$ID\",\"open\":false}" | jq -c '{title, is_open}'
# -> {"title":"Receipts","is_open":false}
curl -s "$RYSTIC_URL/2/file_requests/delete" -H "$H" -H "$J" -d "{\"ids\":[\"$ID\"]}" | jq -c '.file_requests | length'
# -> 1

A shared link lives from the route that mints it to the route that revokes it:

RouteWhat it does with the link
create_shared_link_with_settingsmints a www.dropbox.com link for a path
list_shared_links, get_shared_link_metadataread it
modify_shared_link_settingschanges it
get_shared_link_file (a content route)downloads through it
revoke_shared_linkends it; the link then returns 409 shared_link_not_found

Differs from Dropbox: the link URL is a minted value, and opening it serves nothing. Read the file through get_shared_link_file.

File requests

file_requests/create opens a request at a destination folder, and the other file-request routes manage it:

  • get reads one request; list and list_v2 list them, and list/continue pages through list_v2.
  • count counts them.
  • update changes a request; open: false closes it.
  • delete refuses an open request with 409 file_request_open until update closes it.
  • delete_all_closed removes only the closed requests.

No email goes out for a request.

Differs from Dropbox: the request’s URL is a minted value that serves nothing.

Last updated on