First of all get the access token by authorizing the user from dropbox,how to do is explained in my this blog http://www.oodlestechnologies.com/blogs/How-to-get-account-information-of-Dropbox-user-using-nodejs.
we are going to expand the dropbox.js file and adding the method createDir
In dropbox.js return method add this piece of code.
createDir: function(path, cb) {
Options = {
url: https://api.dropbox.com/1/fileops/create_folder,
json: true,
headers: {
"Authorization": "Bearer " + access_token
},
form: {root:"auto", path:path}
}
request.post(options, function(err, res, body) {
cb(err, res, body);
});
},
And in drop.js file add this piece of code.
api.createDir('/test/testdir/',function(err, res, body){
if(!err) {
console.log(“success”);
}
});
/test/testdir/ this is the nested directory path, in test directory we have created testdir directory.
We have done.
Reference: https://www.dropbox.com/developers/documentation/http/documentation
Thanks.
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Chandan Kumar Singh
Chandan is a bright Web Developer with expertise in Java and Spring framework and ORM tools Hibernate. He loves technologies like Blockchain and IoT.