<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Give file public access after upload through shell script in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Give-file-public-access-after-upload-through-shell-script/m-p/552232#M2196</link>
    <description>&lt;P&gt;Turns out that I was a bit ignorant when looking at what to put in the request. The right request should look like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;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}}"`&lt;/LI-CODE&gt;</description>
    <pubDate>Fri, 22 Oct 2021 13:43:24 GMT</pubDate>
    <dc:creator>tobiasger</dc:creator>
    <dc:date>2021-10-22T13:43:24Z</dc:date>
    <item>
      <title>Give file public access after upload through shell script</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Give-file-public-access-after-upload-through-shell-script/m-p/551991#M2193</link>
      <description>&lt;P&gt;I've used the following code for uploading a file through a shell script in Automator on macOS:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;DROPBOX_TOKEN="MY-TOKEN"
FILE=$1
FILENAME=$(basename "$FILE")

UPLOAD=`curl -sX POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer $DROPBOX_TOKEN" \
--header "Dropbox-API-Arg: {\"path\": \"/psds/$FILENAME\",\"mode\": \"add\",\"autorename\": true,\"mute\": false}" \
--header "Content-Type: application/octet-stream" \
--data-binary @"$FILE"`&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;That works like a charm. I am then using &lt;A href="https://ifttt.com/" target="_self"&gt;IFTTT&lt;/A&gt;&amp;nbsp;with an applet that looks for new files in this folder and then creates a Tumblr post with the file, using it's &lt;STRONG&gt;previewUrl &lt;/STRONG&gt;as the caption. This preview URL is by default only allowing me as the owner to see the file. I'm looking into if there is a way to give the file public access when uploading it.&lt;BR /&gt;&lt;BR /&gt;So I tried adding this to the shell script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;UPLOAD=`curl -sX POST https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings \
--header "Authorization: Bearer $DROPBOX_TOKEN" \
--header "Dropbox-API-Arg: {\"path\": \"/psds/$FILENAME\",\"settings\": {\"audience\": \"public\",\"access\": \"viewer\",\"requested_visibility\": \"public\",\"allow_download\": true}}" \
--header "Content-Type: application/octet-stream" \&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But that is not working. When looking on the file in Dropbox after the upload, it still says that only I got access to it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to give a file public access when uploading it through the API like this?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 18:58:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Give-file-public-access-after-upload-through-shell-script/m-p/551991#M2193</guid>
      <dc:creator>tobiasger</dc:creator>
      <dc:date>2021-10-22T18:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Give file public access after upload through shell script</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Give-file-public-access-after-upload-through-shell-script/m-p/552031#M2194</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 15:21:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Give-file-public-access-after-upload-through-shell-script/m-p/552031#M2194</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-10-21T15:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Give file public access after upload through shell script</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Give-file-public-access-after-upload-through-shell-script/m-p/552232#M2196</link>
      <description>&lt;P&gt;Turns out that I was a bit ignorant when looking at what to put in the request. The right request should look like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;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}}"`&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 22 Oct 2021 13:43:24 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Give-file-public-access-after-upload-through-shell-script/m-p/552232#M2196</guid>
      <dc:creator>tobiasger</dc:creator>
      <dc:date>2021-10-22T13:43:24Z</dc:date>
    </item>
  </channel>
</rss>

