Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

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

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 and API

Node avatar for Discuss Dropbox Developer and API
Explore Dropbox Developer & API discussions with developers like you.

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!