<?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: Dropbox download_zip api in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/391138#M21627</link>
    <description>&lt;P&gt;Thanks for the additional information. I see you have extra&amp;nbsp;&lt;SPAN&gt;\ values in your JSON string. You may have copied those from the command-line curl examples in &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download_zip" target="_self"&gt;the documentation&lt;/A&gt;. Those are only needed in contexts where you need to escape the subsequent " values, such as in bash, like in those examples, since the " character is already used to start the string for the header parameter for curl itself.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Since that doesn't apply to your PHP context, you shouldn't include them as they'll be sent as-is, corrupting the JSON string. Instead, you'd just want something like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;$headers[] = 'Dropbox-Api-Arg: {"path": "/test"}';&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I do&amp;nbsp;recommend having some other library or method build those JSON strings for you instead though.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 Jan 2020 19:04:16 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2020-01-21T19:04:16Z</dc:date>
    <item>
      <title>Dropbox download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/391095#M21616</link>
      <description>&lt;P&gt;I use api &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download_zip" target="_blank"&gt;https://www.dropbox.com/developers/documentation/http/documentation#files-download_zip&lt;/A&gt; to download files from a folder, but I always get an error in call to API function "files / download_zip": HTTP header " Dropbox-API-Arg ": could not decode input as JSON&lt;BR /&gt;please indicate what the problem may be&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 16:06:07 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/391095#M21616</guid>
      <dc:creator>Андрей Г.2</dc:creator>
      <dc:date>2020-01-21T16:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/391112#M21622</link>
      <description>&lt;P&gt;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download_zip" target="_self"&gt;The /2/files/download endpoint&lt;/A&gt; is a "&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#formats" target="_self"&gt;content-download&lt;/A&gt;" style endpoint, so it expects the parameters (such as "path") as JSON in a 'Dropbox-API-Arg' request header.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This "could not decode input as JSON" error indicates that the value supplied in the&amp;nbsp;'Dropbox-API-Arg' request header could not be successfully parsed, likely because it is not valid JSON.&lt;/P&gt;
&lt;P&gt;Please check that you're supplying a valid JSON string in the 'Dropbox-API-Arg' request header. If you're not already using one, we&amp;nbsp;recommend using a JSON library for reading/writing the&amp;nbsp;JSON strings, instead of doing so manually.&lt;/P&gt;
&lt;P&gt;You can also use &lt;A href="https://dropbox.github.io/dropbox-api-v2-explorer/#files_download_zip" target="_self"&gt;the API v2 Explorer&lt;/A&gt; to prototype these calls for you. It will build the header for you, and can even show you the code for making the call.&lt;/P&gt;
&lt;P&gt;If something still isn't working as expected, please share the relevant code and output (but please redact your access token).&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 16:59:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/391112#M21622</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-01-21T16:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/391115#M21624</link>
      <description>&lt;P&gt;&lt;BR /&gt;here is my sample code, i think here everything is right $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, '&lt;A href="https://content.dropboxapi.com/2/files/download_zip" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/download_zip&lt;/A&gt;'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); $headers = array(); $headers[] = 'Authorization: Bearer $token'; $headers[] = 'Dropbox-Api-Arg: {\"path\": \"/test/"}'; $headers[] = "Content-Type: application/octet-stream"; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { &amp;nbsp; &amp;nbsp; echo 'Error:' . curl_error($ch); } curl_close($ch);&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;You can also use&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-api-v2-explorer/#files_download_zip" target="_self" rel="nofollow noopener noreferrer"&gt;the API v2 Explorer&lt;/A&gt;&amp;nbsp;to prototype these calls for you. It will build the header for you, and can even show you the code for making the call.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I used this, I generated the code, but it doesn't work&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 17:08:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/391115#M21624</guid>
      <dc:creator>Андрей Г.2</dc:creator>
      <dc:date>2020-01-21T17:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/391138#M21627</link>
      <description>&lt;P&gt;Thanks for the additional information. I see you have extra&amp;nbsp;&lt;SPAN&gt;\ values in your JSON string. You may have copied those from the command-line curl examples in &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-download_zip" target="_self"&gt;the documentation&lt;/A&gt;. Those are only needed in contexts where you need to escape the subsequent " values, such as in bash, like in those examples, since the " character is already used to start the string for the header parameter for curl itself.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Since that doesn't apply to your PHP context, you shouldn't include them as they'll be sent as-is, corrupting the JSON string. Instead, you'd just want something like:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;$headers[] = 'Dropbox-Api-Arg: {"path": "/test"}';&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;I do&amp;nbsp;recommend having some other library or method build those JSON strings for you instead though.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2020 19:04:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/391138#M21627</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-01-21T19:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/392468#M21656</link>
      <description>&lt;P&gt;function dropbox_download_zip($folder_path, $file_name) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, '&lt;A href="https://content.dropboxapi.com/2/files/download_zip" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/download_zip&lt;/A&gt;'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); $headers = array(); $headers[] = "Authorization: Bearer " . DROPBOX_TOKEN . ""; $headers[] = "Dropbox-API-Arg: {\"path\": \"$folder_path\"}"; $headers[] = "Content-Type: application/octet-stream; charset=utf-8"; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); curl_close($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { $file_name = $file_name . '.zip'; file_put_contents(get_home_path() . '/' . $file_name, $result); $zipFilePath = get_home_path() . $file_name; $zipBaseName = basename($zipFilePath); header("Content-Type: application/zip"); header("Content-Disposition: attachment; filename=$zipBaseName"); header("Content-Length: " . filesize($zipFilePath)); readfile($zipFilePath); &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/575731"&gt;@unlink&lt;/a&gt;($zipFilePath); die(); } }&lt;/P&gt;&lt;P&gt;here is my code, but it only works on a local server, on a real site it produces such an error, why?&amp;nbsp;&lt;A href="https://monosnap.com/file/0Dxbpzchbiq8ngZRl42SNEHqbCvmi1" target="_blank" rel="noopener"&gt;https://monosnap.com/file/0Dxbpzchbiq8ngZRl42SNEHqbCvmi1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jan 2020 20:54:56 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/392468#M21656</guid>
      <dc:creator>polishchyk-a-v</dc:creator>
      <dc:date>2020-01-26T20:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox download_zip api</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/392669#M21661</link>
      <description>&lt;P&gt;I see this was&amp;nbsp;also opened as a new thread, so I'll take a look and reply on that one:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropboxforum.com/t5/Discuss-Developer-API/download-zip-api/m-p/392520#M963" target="_blank"&gt;https://www.dropboxforum.com/t5/Discuss-Developer-API/download-zip-api/m-p/392520#M963&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 16:41:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-download-zip-api/m-p/392669#M21661</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-01-27T16:41:05Z</dc:date>
    </item>
  </channel>
</rss>

