We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
tobiasger
4 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:/...
- 4 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 Staff
The /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.
tobiasger
4 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
795 PostsLatest Activity: 6 days agoIf 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 or Facebook.
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!