Error Posting image post to Twitter



I’m not able to create some image post with particular image urls.


  1. Using as the image url in a post, I got error like this:
    Something is broken at Twitter. Please see

  2. Using other urls like
    I/O error on POST request for “”:Server returned HTTP response code: 403 for URL:; nested exception is Server returned HTTP response code: 403 for URL:

  3. Using urls like
    Error consuming Twitter REST API

Not sure if these urls have violated any rules in the ‘Twitter POST media/upload’ ?


Can you share examples of the code you’re using to upload? I wasn’t aware that the media upload endpoint supported arbitrary URLs as targets for ingest.


Two steps:
Step one:
String MEDIA_UPLOAD = ""
“media” -> URL []
Map response = restTemplate.postForObject(MEDIA_UPLOAD, postParams, Map.class);
//Get media id here:
String mediaID = response.get(“media_id_string”);

Step two:
“status” -> “message”
“media_ids” -> mediaID
String id = restTemplate.postForObject(STATUSES_UPDATE, postParameters, Tweet.class);

For failure:
“I/O error on POST request for … Server returned HTTP response code: 403 for URL”, it failed at first step.
For failure:
“Error consuming Twitter REST API” and “Something is broken at Twitter. Please see”, it failed at the second step. (Which means I can get a media id from the first step, and it shows successful in uploading)


According to the API documentation, the media parameter should contain raw binary file content, not a URL.


This is actually raw binary file content. We did some transfer in backend and it was actually a resource type but not pure String. (public interface Resource extends InputStreamSource)

Also just like I mentioned before, most of them are successfully uploaded in the MEDIA_UPLOAD process but failed at the second process STATUSES_UPDATE.


Are you able to confirm that the files you are attempting to upload conform to the specification?

We’d need more information on the successful and failing posts to help to diagnose, I think. Can you narrow down specific test cases?


Successful case:

Failed cases:


Here’s the request

POST /1/statuses/update.json?include_entities=true HTTP/1.1
Accept: /
Connection: close
User-Agent: OAuth gem v0.4.4
Content-Type: application/x-www-form-urlencoded
omit oauth data
Content-Length: 76


So one of the offending image is 790703260990439426.