Is there a way to upload a new profile image using the REST API (/1.1/account/update_profile_image.json)? Using axios with node.js, I’m finding that if I use a base64 encoded image as a query param, I get a 431 error “Request Header Fields Too Large”.
Here’s the actual response (with oauth stuff removed and image string shortened):
[debug] err.response {
"status": 431,
"statusText": "Request Header Fields Too Large",
"headers": {
"content-length": "31",
"content-type": "text/plain",
"x-connection-hash": "89e8c512a7f057033b7bf58cca26ff0eba205d371b15fca29f8c344dfe8113ad",
"date": "Tue, 12 Oct 2021 19:19:33 GMT",
"server": "tsa_b",
"connection": "close"
},
"config": {
"url": "https://api.twitter.com/1.1/account/update_profile_image.json",
"method": "post",
"params": {
"image": "/9j/4AAQSkZJRgABAQAASABIAAD/4gJASUNDX1BST0ZJTEUAAQEAAAIwQURCRQIQAABtbnR..."
},
"headers": {
"Accept": "application/json, text/plain, */*",
"Content-Type": "multipart/form-data",
"Authorization": "OAuth oauth_consumer_key=\"removed\", oauth_nonce=\"removed\", oauth_signature=\"removed\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1634066373\", oauth_token=\"removed\", oauth_version=\"1.0\"",
"User-Agent": "axios/0.19.2"
},
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1
},
"data": "Request Header Fields Too Large"
}
system
Closed
#3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.