Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
tobiasger
5 years agoHelpful | Level 5
Give file public access after upload through shell script
I've used the following code for uploading a file through a shell script in Automator on macOS:
DROPBOX_TOKEN="MY-TOKEN"
FILE=$1
FILENAME=$(basename "$FILE")
UPLOAD=`curl -sX POST https:/...
- 5 years ago
Turns out that I was a bit ignorant when looking at what to put in the request. The right request should look like this:
UPLOAD=`curl -sX POST https://api.dropbox.com/2/sharing/create_shared_link_with_settings \ --header "Authorization: Bearer $DROPBOX_TOKEN" \ --header "Content-Type: application/json" \ --data "{\"path\": \"/psds/$FILENAME\",\"settings\": {\"audience\": \"public\",\"access\": \"viewer\",\"requested_visibility\": \"public\",\"allow_download\": true}}"`
Greg-DB
Dropbox Community Moderator
5 years agoThe /2/sharing/create_shared_link_with_settings endpoint is the right way to create a shared link for a file, e.g., for public access. Can you print out the response body you get from that call? It should contain either the result, with the created shared link, or an error indicating why the call failed.
- tobiasger5 years agoHelpful | Level 5
Turns out that I was a bit ignorant when looking at what to put in the request. The right request should look like this:
UPLOAD=`curl -sX POST https://api.dropbox.com/2/sharing/create_shared_link_with_settings \ --header "Authorization: Bearer $DROPBOX_TOKEN" \ --header "Content-Type: application/json" \ --data "{\"path\": \"/psds/$FILENAME\",\"settings\": {\"audience\": \"public\",\"access\": \"viewer\",\"requested_visibility\": \"public\",\"allow_download\": true}}"`
About Discuss Dropbox Developer & API
Make connections with other developers
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!