Update_profile_banner not working

restapi
api
bots

#1

Hello guys. I’m trying to change a profile’s banner using the REST API. I’m posting the base64 encoded image to the provided json and I’m getting no errors, but the banner is still not changing. I’m using NodeJS with twit package and this is my current code: function banner(file){ fs.readFile(file, {encoding: 'base64'}, function(err, base64data) { T.post("account/update_profile_banner", {banner : base64data, _base64:true}, function (err, body, response) { if (err) { console.log("Failed to changed banner : ", err, body); } else { console.log("Changed banner : ", body); } }); }); }
Hope there is a fix!
Thanks in advance and looking forward to your answers!


#2

OK, not the timeliest reply, but here goes. If you watch the upload process when you update the banner image manually in the browser, you’ll notice that it uses chunked media and media_id. To replicate this in Twit, use postMediaChunked and grab the media_id_string from the response and then use the endpoint you mentioned (update_profile_banner), but exclude the banner key and instead use media_id (I actually put in mediaId as well just to be sure, haven’t looked deeper into this).