Description
I am trying to upload a profile picture with Node.js and the form-data/axios modules and nothing is working
Error
Response contains:
{ data: { code: -1, message: “Required request part ‘pic_file’ is not present” } }
Which App Type (OAuth / Chatbot / JWT / Webhook)?
OAuth
Which Endpoint/s?
/v2/users///picture
How To Reproduce (If applicable)
Code I’m using:
const img = request.body.base64img;
const imgParts = img.split(’,’);
const userid = request.body.userid;
const stream = bufferToStream(Buffer.from(imgParts[1], ‘base64’));
let formData = new FormData();
formData.append(‘pic_file’, stream);
axios.post(https://api.zoom.us/v2/users/${userid}/picture
, formData, {
headers: {
…formData.getHeaders(),
‘Authorization’: Bearer ${adminToken.admin_token}
}
}).then(response => {
console.dir(response);
}).catch(err => {
console.log(err);
});
bufferToStream just takes a Buffer and converts it to a stream … I was only trying that to see if it worked.
Anyone have any experience with this?