Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I am integrating salesforce with Dropbox.
But when i am trying to hit the api it showing error.
Error -
HTTP header "Dropbox-API-Arg": could not decode input as JSON
Code -
string token = 'https://content.dropboxapi.com/2/files/upload';
HttpRequest r = new HttpRequest();
r.setEndpoint(token);
r.setHeader('Authorization','Bearer ' +accesstoken);
r.setheader('content-type','application/octet-stream');
r.setheader('Dropbox-API-Arg', JSON.stringify({\'path\': response.data.entries[i].id}));
r.setMethod('POST');
r.setTimeout(60000);*/
Attachment at = [ SELECT Name, body
FROM Attachment
LIMIT 1];
//here we input file as blob for save in DROP BOX
r.setBodyAsBlob(at.body);
Http h1 = new Http();
HttpResponse res1;
string resp1;
res1 = h1.send(r);
resp1 = res1.getBody();
Hello,
You're writing this in Apex, correct?
That error means that the value being sent back with the "Dropbox-API-Arg" header isn't valid JSON.
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 here.
Try changing the method and see if that helps.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
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!