Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Issac J.
10 years agoNew member | Level 1
How to download file from Dropbox using javascript dropbox api
I tried to download a file from Dropbox using Core Api with javascript(without using chooser api). Here is the method I have written.
function download(path, token){
var url = "https://api-content.dropbox.com/1/files/auto/" + path;
var result;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
result = xhr.responseText;
}
}
xhr.open("GET", url, true);
xhr.setRequestHeader("Authorization", "Bearer " + token);
xhr.send();
}
Here is the response I got.
<html>
<head><title>400 The plain HTTP request was sent to HTTPS port</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<center>The plain HTTP request was sent to HTTPS port</center>
<hr><center>nginx</center>
</body>
</html>
Any idea about what's wrong with this code...???
1 Reply
Replies have been turned off for this discussion
- Steve M.10 years ago
Dropbox Staff
Cross-linking with http://stackoverflow.com/questions/31645523/download-file-from-dropbox-using-javascript-dropbox-api.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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, Facebook or Instagram.
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!