<?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 I am getting error when i am trying to upload file from salesforce. in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/I-am-getting-error-when-i-am-trying-to-upload-file-from/m-p/352461#M20171</link>
    <description>&lt;P&gt;I am integrating salesforce with Dropbox.&lt;BR /&gt;But when i am trying to hit the api it showing error.&lt;BR /&gt;&lt;BR /&gt;Error -&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;HTTP header "Dropbox-API-Arg": could not decode input as JSON&lt;/PRE&gt;
&lt;P&gt;Code -&amp;nbsp;&lt;BR /&gt;string token = '&lt;A href="https://content.dropboxapi.com/2/files/upload" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/upload&lt;/A&gt;';&lt;BR /&gt;HttpRequest r = new HttpRequest();&lt;BR /&gt;r.setEndpoint(token);&lt;BR /&gt;r.setHeader('Authorization','Bearer ' +accesstoken);&lt;BR /&gt;r.setheader('content-type','application/octet-stream');&lt;BR /&gt;r.setheader('Dropbox-API-Arg', JSON.stringify({\'path\': response.data.entries[i].id}));&lt;BR /&gt;r.setMethod('POST');&lt;BR /&gt;r.setTimeout(60000);*/&lt;BR /&gt;Attachment at = [ SELECT Name, body&lt;BR /&gt;FROM Attachment&lt;BR /&gt;LIMIT 1];&lt;BR /&gt;//here we input file as blob for save in DROP BOX&lt;BR /&gt;r.setBodyAsBlob(at.body);&lt;BR /&gt;Http h1 = new Http();&lt;BR /&gt;HttpResponse res1;&lt;BR /&gt;string resp1;&lt;BR /&gt;res1 = h1.send(r);&lt;BR /&gt;resp1 = res1.getBody();&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 12 Sep 2019 12:19:36 GMT</pubDate>
    <dc:creator>BiswojeetRay</dc:creator>
    <dc:date>2019-09-12T12:19:36Z</dc:date>
    <item>
      <title>I am getting error when i am trying to upload file from salesforce.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/I-am-getting-error-when-i-am-trying-to-upload-file-from/m-p/352461#M20171</link>
      <description>&lt;P&gt;I am integrating salesforce with Dropbox.&lt;BR /&gt;But when i am trying to hit the api it showing error.&lt;BR /&gt;&lt;BR /&gt;Error -&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;HTTP header "Dropbox-API-Arg": could not decode input as JSON&lt;/PRE&gt;
&lt;P&gt;Code -&amp;nbsp;&lt;BR /&gt;string token = '&lt;A href="https://content.dropboxapi.com/2/files/upload" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/upload&lt;/A&gt;';&lt;BR /&gt;HttpRequest r = new HttpRequest();&lt;BR /&gt;r.setEndpoint(token);&lt;BR /&gt;r.setHeader('Authorization','Bearer ' +accesstoken);&lt;BR /&gt;r.setheader('content-type','application/octet-stream');&lt;BR /&gt;r.setheader('Dropbox-API-Arg', JSON.stringify({\'path\': response.data.entries[i].id}));&lt;BR /&gt;r.setMethod('POST');&lt;BR /&gt;r.setTimeout(60000);*/&lt;BR /&gt;Attachment at = [ SELECT Name, body&lt;BR /&gt;FROM Attachment&lt;BR /&gt;LIMIT 1];&lt;BR /&gt;//here we input file as blob for save in DROP BOX&lt;BR /&gt;r.setBodyAsBlob(at.body);&lt;BR /&gt;Http h1 = new Http();&lt;BR /&gt;HttpResponse res1;&lt;BR /&gt;string resp1;&lt;BR /&gt;res1 = h1.send(r);&lt;BR /&gt;resp1 = res1.getBody();&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 12:19:36 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/I-am-getting-error-when-i-am-trying-to-upload-file-from/m-p/352461#M20171</guid>
      <dc:creator>BiswojeetRay</dc:creator>
      <dc:date>2019-09-12T12:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: I am getting error when i am trying to upload file from salesforce.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/I-am-getting-error-when-i-am-trying-to-upload-file-from/m-p/352503#M20174</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You're writing this in Apex, correct?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That error means that the value being sent back with the "Dropbox-API-Arg" header isn't valid JSON.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The `JSON.Stringify()` method you're using doesn't exist in all languages. Instead, Apex has a method called `JSON.Serialize()`. You can read about it &lt;A href="https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_System_Json.htm" target="_self"&gt;here&lt;/A&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Try changing the method and see if that helps. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 16:08:46 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/I-am-getting-error-when-i-am-trying-to-upload-file-from/m-p/352503#M20174</guid>
      <dc:creator>TaylorKrusen</dc:creator>
      <dc:date>2019-06-28T16:08:46Z</dc:date>
    </item>
  </channel>
</rss>

