Twurl with update_with_media won't work


#1

I installed twurl and succesfully tested it with twurl -d ‘status=Testing twurl’ /1.1/statuses/update.json

When I modified the code offered in https://dev.twitter.com/docs/uploading-media it does not work:

twurl -X POST “/1.1/statuses/update_with_media.json” --file “/path/to/media.png” --file-field “media[]” -d “status=Hello 2012-09-07 15:51:41.375247 -0700 PDT!”

twurl -X POST “/1.1/statuses/update_with_media.json” --file “c:\image.jpg” --file-field “media[]” -d “status=Hello 2012-09-07 15:51:41.375247 -0700 PDT!”

I tested several images, one downloaded from a published tweet.

I think the problem is with the image path, but I cannot figure it out

Please help


#2

I cannot find a solution. This is as far as I got. Can anyone provide some hint? twurl should be quite straight forward so I cannot understand why it is not working. I added the -b in case the encoding was an issue.
As I said, I can update a status with no photo with twurl using
twurl -d ‘status=Testing twurl’ /1.1/statuses/update.json
but in that same console (Start command prompt with Rubi) I cannot make this one work:

twurl -X POST “/1.1/statuses/update_with_media.json” --file “img.jpg” -d “status=Hello 2012-09-07 15:51:41.375247 -0700 PDT!” -b -t
This is the response:
C:>twurl -X POST “/1.1/statuses/update_with_media.json” --file “img.jpg” -d “st
atus=Hello 2012-09-07 15:51:41.375247 -0700 PDT!” -b -t
opening connection to api.twitter.com
opened
<- “POST /1.1/statuses/update_with_media.json HTTP/1.1\r\nAccept: /\r\nUser-Ag
ent: OAuth gem v0.4.7\r\nContent-Type: multipart/form-data, boundary=“00Twurl34
9395174743795515lruwT99”\r\nAuthorization: OAuth oauth_body_hash=“23K7BUqrBFsm
vnezPXK0h4YCJxc%3D”, oauth_consumer_key=“cQp2BPoRRUU9192p8bTyi3BXV”, oauth_no
nce=“I8dkrNXhStGOiQ8ds72MNWHZG568TYeebhwcErZe32A”, oauth_signature=“ETbs3R4ej
lg19UxSxup4gD%2FYbHk%3D”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp
=“1401908213”, oauth_token=“87017768-FCXtOvhbGYRbwiTMeEV30tE4OSqLiFDPP5cvWyDN
z”, oauth_version=“1.0”\r\nConnection: close\r\nHost: api.twitter.com\r\nCont
ent-Length: 425\r\n\r\n”
<- “–00Twurl349395174743795515lruwT99\r\nContent-Disposition: form-data; name=
“status”\r\n\r\nHello 2012-09-07 15:51:41.375247 -0700 PDT!\r\n–00Twurl3493951
74743795515lruwT99\r\nContent-Disposition: form-data; name=“media[]”; filename
=“img.jpg”\r\nContent-Type: application/octet-stream\r\nContent-Transfer-Encod
ing: base64\r\n\r\n/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsL
nDBkSEw8UHQ==\n\r\n–00Twurl349395174743795515lruwT99–\r\n”
-> “HTTP/1.1 403 Forbidden\r\n”
-> “cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=
0\r\n”
-> “content-length: 60\r\n”
-> “content-type: application/json;charset=utf-8\r\n”
-> “date: Wed, 04 Jun 2014 18:59:28 GMT\r\n”
-> “expires: Tue, 31 Mar 1981 05:00:00 GMT\r\n”
-> “last-modified: Wed, 04 Jun 2014 18:59:28 GMT\r\n”
-> “pragma: no-cache\r\n”
-> “server: tfe\r\n”
-> “set-cookie: lang=en\r\n”
-> “set-cookie: guest_id=v1%3A140190836852881541; Domain=.twitter.com; Path=/; E
xpires=Fri, 03-Jun-2016 18:59:28 UTC\r\n”
-> “status: 403 Forbidden\r\n”
-> “strict-transport-security: max-age=631138519\r\n”
-> “x-access-level: read-write-directmessages\r\n”
-> “x-content-type-options: nosniff\r\n”
-> “x-frame-options: SAMEORIGIN\r\n”
-> “x-mediaratelimit-class: photos\r\n”
-> “x-mediaratelimit-limit: 3000\r\n”
-> “x-mediaratelimit-remaining: 2980\r\n”
-> “x-mediaratelimit-reset: 1401966520\r\n”
-> “x-transaction: 2714568fe005837d\r\n”
-> “x-xss-protection: 1; mode=block\r\n”
-> “Connection: close\r\n”
-> "\r\n"
reading 60 bytes…
-> “”
-> “{“errors”:[{“code”:189,“message”:“Error creating status.”}]}”
{“errors”:[{“code”:189,“message”:“Error creating status.”}]}read 60 bytes
Conn close


#3

Hey Boston Pilot,

Error code 189 is an error relating to corrupt image data or an invalid image type being uploaded. We’re going to document that on our [node:130] page, as well as update the error response itself to be more useful.

In the meantime, do you happen to have the image that is causing this error response someone we could download it and test with?