Update with Media (png) returning error code 500


Trying to expand our current API to include update_with_media.

We are using Perl Net::Twitter::Lite::WithAPIv1_1 and it’s been working well.

When testing update_with_media using simple PNG’s, we are getting strange results.
Most are fine, but we can replicate failures, with returned error codes of 500 from the API.

These work:

-> identify part2
part2 PNG 500x500 500x500+0+0 DirectClass 11kb

These don’t:

identify part2
part2 PNG 500x500 500x500+0+0 DirectClass 3.4kb

Apart from the image size, they appear to be valid PNG’s and we can’t see the difference.

Are there any Twitter API restrictions on media size?

Any advice is much appreciated.


There shouldn’t be any issue with files of that size - the limits are in the Mb not kb. Are you able to provide sample files?

However, I would point out that update_with_media is a deprecated endpoint and would strongly recommend that you adopt the newer multi-step media upload path. We have a Media APIs category for questions on that.


Thanks for pointing me at media upload, Andy.

In the short term, we’d like to understand the problem.
How can I provide sample files to you?


Can you put them anywhere public online where we can take a look at them?


You can see the two test images here…

part2.brush.png works fine through the Rest API (using Perl).
part2.red-blue.png fails through the API each time (error code 500).


Moving this over to the Media APIs category so hopefully someone can take a look.