# Shared links and file requests

Shared links to a file or folder, read, changed and revoked as Dropbox's are, and file requests that open at a destination folder and close before they delete.

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:

```bash
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:

```bash
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
```

### Shared links

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

| Route | What it does with the link |
|---|---|
| `create_shared_link_with_settings` | mints a `www.dropbox.com` link for a path |
| `list_shared_links`, `get_shared_link_metadata` | read it |
| `modify_shared_link_settings` | changes it |
| `get_shared_link_file` (a content route) | downloads through it |
| `revoke_shared_link` | ends 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.

---

Source: https://www.rystic.ai/docs/simulators/dropbox/features/shared-links-and-requests · Markdown: https://www.rystic.ai/docs/simulators/dropbox/features/shared-links-and-requests.md
