We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

tobiasger's avatar
tobiasger
Helpful | Level 5
4 years ago

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:/...
  • tobiasger's avatar
    tobiasger
    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}}"`

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API

Make connections with other developers

795 PostsLatest Activity: 6 days ago
192 Following

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 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!