500 error with upload_with_media



I’m having issues sending tweets with a picture. I’m working on a twitter client within 3dsMax which is working just fine. Only the upload_with_media responds with a {“errors”:[{“message”:“Internal error”,“code”:131}]} message. This is the request I’m sending
POST https://api.twitter.com/1.1/statuses/update_with_media.json HTTP/1.1
Content-Type: multipart/form-data; boundary=klaasnienhuis_tweetMax_publisher123456789
Authorization: OAuth oauth_consumer_key=“xxx”,oauth_nonce=“12618215-1496107888”,oauth_signature=“YJZ1DTykSYgUDQbalMpElD0%2F1%2Bo%3D”,oauth_signature_method=“HMAC-SHA1”,oauth_timestamp=“1370268456”,oauth_token=“xxx”,oauth_version="1.0"
Host: api.twitter.com
Content-Length: 2029
Expect: 100-continue
Connection: Keep-Alive

Content-Disposition: form-data; name=“status”

Content-Disposition: form-data; name=“media[]”; filename="lod_4.png"
Content-Type: application/octet-stream

—some more image data—
Does somebody have an idea what’s wrong with this?


Do I maybe need to url-encode the imagedata? Or send it as a base64? At the moment I’m sending just the raw bytes.


Line 17 and 18 should be just a single blank line I think.
Line 8 and 9 are allowed by the standard, but others have used just a single leading blank line.

From what I understand you do not url encode the data or use base 64, you should append the raw bytes.

Mind you, I am having the same problem, betting the same 500 error with code 131.


My own post is available here


My problem was solved, I needed a – suffix for the final boundary.