Restore a backup from a file
amber_upload_backupOpens a drag-and-drop panel to restore a backup stored on the user's computer, uploading the selected file directly to storage without passing through the chat.
Instructions
Show the user a drag-and-drop panel for restoring a backup that is on THEIR COMPUTER. Call this with no arguments when someone wants to restore and the file is local -- they pick it, and it uploads straight to storage without passing through this conversation.
IF THE BACKUP IS ALREADY ONLINE (S3, R2, Backblaze, a presigned link) use amber_import_memories with the URL instead; that needs no upload at all and is the better path.
The prepare and finish actions are driven BY THE PANEL, not by you. Call this with no arguments and let the person use it; then poll amber_get_import_status for progress.
IF YOUR CLIENT CANNOT RENDER PANELS, tell them to open https://ambermem.com/restore instead. It is the same uploader as an ordinary web page, and it needs a key from amber_create_backup_key. Requires an active subscription.
Errors: invalid_params (finish called without a task_id), not_found (no upload with that id, or it belongs to another account), nothing_uploaded (finish called but nothing arrived at the upload link), invalid_archive (via amber_get_import_status, not from this call: what was uploaded is not a readable Amber backup; that task is marked failed, so start a new one), not_startable (the upload is no longer in a state that can begin, for example it already ran or already failed; ask for a fresh link and send the file again, which duplicates nothing because memories keep their ids).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | Leave this out. The upload panel sets it; calling it yourself does nothing a user can see. | |
| task_id | No | Set by the panel on `finish`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | `panel` means the upload panel was shown and the person drives it from here. | |
| task_id | No | Present once an upload has been prepared. | |
| upload_url | No | For the panel only. Do not show this to the user. | |
| restore_url | No | A link the user opens to upload their backup file. Needs no backup key. Relay it verbatim. | |
| expires_in_seconds | No | How long the upload link stays valid. The signature is checked when the request STARTS, so an upload may run longer than this. |