I'm trying to use the V2 end points for file upload. I believe the content headers are set right but I keep getting this error. Can anyone help please ?
const request = require('request');
var fs = require('fs');
var apiArgs = '{ "path" : "/testfolder/Nespresso.zip", "mode" : "add", "autorename" : true, "mute" : false }' ;
var formData = {
'data-binary': fs.createReadStream("F:\\Nespresso.zip")
};
const options = {
headers: {
'Authorization' : 'Bearer ############',
'Content-Type' : 'application/octet-stream',
'Dropbox-API-Arg': apiArgs
},
formData : formData
};
request.post('https://content.dropboxapi.com/2/files/upload', options, function(err, res, body) {
//let json = JSON.parse(body);
console.log(body);
if(res)
console.log(res.statusCode);
if(err)
console.log(err);
});
Error on node :
Error in call to API function "files/upload": Bad HTTP "Content-Type" header: "m ultipart/form-data; boundary=--------------------------298294176382492406791283" . Expecting one of "application/octet-stream", "text/plain; charset=dropbox-cor s-hack". 400