Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here.
Forum Discussion
Fab_R
8 years agoExplorer | Level 3
Upload File Api
Hey guys,
I'm getting a pdf content and want to upload it in my dropbox with the API.
When i'm sending the request with the /upload method, i'm getting no response from dropbox ...
Can you please help on that ?
Here is my code :
HttpRequest req = new HttpRequest();
req.setEndpoint('https://content.dropboxapi.com/2/files/upload');
req.setHeader('Authorization','Bearer ' + token);
req.setHeader('Dropbox-API-Arg','{\"path\": \"/Liasses/Test.txt\",\"mode\": \"add\",\"autorename\":false}');
req.setHeader('Content-Type','application/octet-stream');
req.setMethod('POST');
req.setBody(EncodingUtil.base64Encode(blobToEncode));
req.setTimeout(60000);
Http h = new http();
HttpResponse res = new HttpResponse();
string resp = res.getBody();
system.debug('response : ' + resp);
Thanks in advance !
- It looks like you're using a third party HTTP client, and not one of our official SDKs, so we can't offer help with how to construct the call with your client.
That said, looking at your code, you don't appear to actually be using your `req` object. You probably need something like `HTTPResponse res = h.send(req);`. I recommend referring to the documentation for this HTTP client for information on how to make requests.
1 Reply
Replies have been turned off for this discussion
- Greg-DB8 years ago
Dropbox Community Moderator
It looks like you're using a third party HTTP client, and not one of our official SDKs, so we can't offer help with how to construct the call with your client.
That said, looking at your code, you don't appear to actually be using your `req` object. You probably need something like `HTTPResponse res = h.send(req);`. I recommend referring to the documentation for this HTTP client for information on how to make requests.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,038 PostsLatest Activity: 13 hours ago
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or 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!