Reputation: 6189
Following the indications provided by this gem , testing in the Rails console the RestClient
RestClient.post "https://upload.twitter.com/1.1/media/upload.json?media_category=tweet_image", :myfile => File.new("/Users/main/Desktop/ss2022-11-03_11.39.11.png", 'rb')
one can assert that the file exists by changing its path. Once verified, the response returns
400 Bad Request
. So the request is malformed. Alas, I do not grasp what the second element of the File.new
represents
The version 1.1 API documentation provides a suggestion console test
twurl -X POST -H upload.twitter.com "/1.1/media/upload.json?media_category=TWEET_IMAGE&additional_owners=3805104374" -f adsapi-heirarchy.png -F media
the response is the same whether the additional_owners
is included or not (logical, it is optional).
What is missing in this sequence?
Upvotes: 0
Views: 15
Reputation: 6189
Thr translation of the twurl syntax to curl syntax would be:
curl "https://upload.twitter.com/1.1/media/upload.json?media_category=tweet_image&additional_owners=3805104374" --data-urlencode @/Users/main/Desktop/adsapi-heirarchy.png --data-urlencode 'media'
Upvotes: 0