37 lines
1.2 KiB
Markdown
37 lines
1.2 KiB
Markdown
|
|
outline of sharry uploading
|
||
|
|
|
||
|
|
1. POST to "new" route
|
||
|
|
- uri: https://sharry.yavook.de/api/v2/alias/upload/new
|
||
|
|
- hdr: `Sharry-Alias: $alias_id`
|
||
|
|
- res.status == 200
|
||
|
|
- res_json.success == true
|
||
|
|
- res_json.message == "Share created."
|
||
|
|
- $share_id := res_json.id
|
||
|
|
|
||
|
|
1. POST to "tus" route
|
||
|
|
- uri: https://sharry.yavook.de/api/v2/alias/upload/$share_id/files/tus
|
||
|
|
- hdr: `Sharry-Alias: $alias_id`
|
||
|
|
- hdr: `Sharry-File-Length: $file_bytes`
|
||
|
|
- hdr: `Sharry-File-Name: $file_name`
|
||
|
|
- hdr: `Sharry-File-Type: $file_mimetype`
|
||
|
|
- hdr: `Tus-Resumable: 1.0.0`
|
||
|
|
- hdr: `Upload-Length: $file_bytes`
|
||
|
|
- res.status == 201
|
||
|
|
- $patch_uri := res_hdr.Location
|
||
|
|
|
||
|
|
1. (multi) PATCH to "$patch_uri"
|
||
|
|
- hdr: `Sharry-Alias`, `Sharry-File-Length`, `Sharry-File-Name`, `Sharry-File-Type`, `Tus-Resumable`
|
||
|
|
- hdr: `Upload-Offset: 10485760 * (n-1)` for nth chunk
|
||
|
|
- body: up to 10 MiB of binary data
|
||
|
|
- res.status == 204
|
||
|
|
- better use res_hdr.Upload-Offset
|
||
|
|
|
||
|
|
1. (opt) POST to "notify" route
|
||
|
|
- uri: https://sharry.yavook.de/api/v2/alias/mail/notify/$share_id
|
||
|
|
- hdr: `Sharry-Alias`
|
||
|
|
- res.status == 200
|
||
|
|
- res_json.success, res_json.message
|
||
|
|
|
||
|
|
hints
|
||
|
|
|
||
|
|
- https://stackoverflow.com/questions/59586787/rust-how-to-do-http-put-of-large-files
|