<?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 NetSuite Server Side SS2.x Script to upload files to Dropbox - body encoding issue in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/NetSuite-Server-Side-SS2-x-Script-to-upload-files-to-Dropbox/m-p/463196#M1539</link>
    <description>&lt;P&gt;Hi team&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to upload a file to Dropbox via the API using a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;user event (server side)&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;script in NetSuite.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get a file to be uploaded, but having an issue with the "body" encoding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thus far, my https request looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;URL and headers:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image1.png" style="width: 815px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/18520iE55E24233CCDC870/image-size/large?v=v2&amp;amp;px=999" role="button" title="image1.png" alt="image1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the body is being set as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var httpsRequest = {
                    method: https.Method.POST,
                    url: request.url,
                    headers: request.headers,
                    body : data.content,
                };&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;data.content&lt;/STRONG&gt; is the file from the NS file cabinet, extracted with &lt;STRONG&gt;myfile.getContents()&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When loading the file it looks like Base64.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried re-encoding the file contents to (UTF_8 to Base64), but the file is still unreadable when synced to the desktop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i do the request from Postman to Dropbox it works, then when I change the URL to a request.bin, the working "body" is structured like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image2.png" style="width: 420px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/18521iE2E2F594BBE59A56/image-size/large?v=v2&amp;amp;px=999" role="button" title="image2.png" alt="image2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when coming from NetSuite, the same data looks like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image3.png" style="width: 347px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/18522iB76CDE111BA56703/image-size/large?v=v2&amp;amp;px=999" role="button" title="image3.png" alt="image3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm not sure how I set the "body" in my NetSuite request to be received in the same way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated, and save what little hair I have left.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Oct 2020 02:02:50 GMT</pubDate>
    <dc:creator>StefanReeder</dc:creator>
    <dc:date>2020-10-21T02:02:50Z</dc:date>
    <item>
      <title>NetSuite Server Side SS2.x Script to upload files to Dropbox - body encoding issue</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/NetSuite-Server-Side-SS2-x-Script-to-upload-files-to-Dropbox/m-p/463196#M1539</link>
      <description>&lt;P&gt;Hi team&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to upload a file to Dropbox via the API using a&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG&gt;user event (server side)&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;script in NetSuite.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can get a file to be uploaded, but having an issue with the "body" encoding.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thus far, my https request looks like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;URL and headers:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image1.png" style="width: 815px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/18520iE55E24233CCDC870/image-size/large?v=v2&amp;amp;px=999" role="button" title="image1.png" alt="image1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and the body is being set as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var httpsRequest = {
                    method: https.Method.POST,
                    url: request.url,
                    headers: request.headers,
                    body : data.content,
                };&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;data.content&lt;/STRONG&gt; is the file from the NS file cabinet, extracted with &lt;STRONG&gt;myfile.getContents()&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When loading the file it looks like Base64.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also tried re-encoding the file contents to (UTF_8 to Base64), but the file is still unreadable when synced to the desktop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i do the request from Postman to Dropbox it works, then when I change the URL to a request.bin, the working "body" is structured like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image2.png" style="width: 420px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/18521iE2E2F594BBE59A56/image-size/large?v=v2&amp;amp;px=999" role="button" title="image2.png" alt="image2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when coming from NetSuite, the same data looks like:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image3.png" style="width: 347px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/18522iB76CDE111BA56703/image-size/large?v=v2&amp;amp;px=999" role="button" title="image3.png" alt="image3.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm not sure how I set the "body" in my NetSuite request to be received in the same way?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated, and save what little hair I have left.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 02:02:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/NetSuite-Server-Side-SS2-x-Script-to-upload-files-to-Dropbox/m-p/463196#M1539</guid>
      <dc:creator>StefanReeder</dc:creator>
      <dc:date>2020-10-21T02:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: NetSuite Server Side SS2.x Script to upload files to Dropbox - body encoding issue</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/NetSuite-Server-Side-SS2-x-Script-to-upload-files-to-Dropbox/m-p/463416#M1540</link>
      <description>&lt;P&gt;[Cross-linking for reference:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/64454739/using-server-side-ss2-x-to-upload-files-to-dropbox-body-encoding-issue" target="_self"&gt;https://stackoverflow.com/questions/64454739/using-server-side-ss2-x-to-upload-files-to-dropbox-body-encoding-issue&lt;/A&gt; ]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't offer help with the NetSuite side of things, as that's not made by Dropbox, but for reference, &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#files-upload" target="_self"&gt;the&amp;nbsp;/2/files/upload&amp;nbsp;Dropbox API endpoint&lt;/A&gt; is &lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#formats" target="_blank"&gt;a "content-upload" style&lt;/A&gt; endpoint, meaning it expects the file data in the HTTPS request body. The data should be sent just as a raw octet-stream (per the "Content-Type"), without any additional encoding. (Dropbox doesn't perform any additional operations, such as encoding/decoding, on the received data before storing it.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, for example, if your data source is giving you your file data encoded with base64 encoding, you may need to base64-decode it before sending it to Dropbox.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 15:43:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/NetSuite-Server-Side-SS2-x-Script-to-upload-files-to-Dropbox/m-p/463416#M1540</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-10-21T15:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: NetSuite Server Side SS2.x Script to upload files to Dropbox - body encoding issue</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/NetSuite-Server-Side-SS2-x-Script-to-upload-files-to-Dropbox/m-p/698186#M3465</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Did you find any solution to tackle this?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 06:35:09 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/NetSuite-Server-Side-SS2-x-Script-to-upload-files-to-Dropbox/m-p/698186#M3465</guid>
      <dc:creator>Anonymous One</dc:creator>
      <dc:date>2023-07-12T06:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: NetSuite Server Side SS2.x Script to upload files to Dropbox - body encoding issue</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/NetSuite-Server-Side-SS2-x-Script-to-upload-files-to-Dropbox/m-p/698289#M3467</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1724855"&gt;@Anonymous One&lt;/a&gt;&amp;nbsp;I see you also posted &lt;A href="https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-file-into-Drop-Box-From-NetSuite-Using-SuiteScript/td-p/698184" target="_blank"&gt;your own thread&lt;/A&gt;, so we'll follow up with you there.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2023 15:19:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/NetSuite-Server-Side-SS2-x-Script-to-upload-files-to-Dropbox/m-p/698289#M3467</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-07-12T15:19:55Z</dc:date>
    </item>
  </channel>
</rss>

