With Seafile one is able to create a public upload link (e.g. https://cloud.seafile.com/u/d/98233edf89/
) to upload files via Browser w/o authentication.
Seafile webapi does not support any upload w/o authentication token.
How can I use such kind of link from command line with curl or from python script?
needed 2 hours to find a solution with curl, it needs two steps:
repo-id
as query parameter as follows:curl 'https://cloud.seafile.com/ajax/u/d/98233edf89/upload/?r=f3e30b25-aad7-4e92-b6fd-4665760dd6f5' -H 'Accept: application/json' -H 'X-Requested-With: XMLHttpRequest'
The answer is (json) a id-link to use in next upload-post e.g.:
{"url": "https://cloud.seafile.com/seafhttp/upload-aj/c2b6d367-22e4-4819-a5fb-6a8f9d783680"}
curl 'https://cloud.seafile.com/seafhttp/upload-aj/c2b6d367-22e4-4819-a5fb-6a8f9d783680' -F file=@./tmp/index.html -F filename=index.html -F parent_dir="/my-repo-dir/"
The answer is json again, e.g.
[{"name": "index.html", "id": "0a0742facf24226a2901d258a1c95e369210bcf3", "size": 10521}]
done ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With