twitter / twurl

OAuth-enabled curl for the Twitter API

Home Page:https://developer.twitter.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

parse error in uploading video file at twitter api version 1.1

Avdhesh51000 opened this issue · comments

I am able to upload image and mp3 files but when i am trying to upload video from rails console to twitter api version 1.1 by using ->

ActiveSupport::JSON.decode(twurl -H upload.twitter.com -X POST "/1.1/media/upload.json" --file "/home/administrator/Downloads/aaa.mp4" --file-field "media")

OR

ActiveSupport::JSON.decode(twurl -H upload.twitter.com "/1.1/media/upload.json" -d "command=APPEND&media_id=1036534176307208192&segment_index=0" --file /home/administrator/Downloads/demo3.mp4 --file-field "media" )

and getting ->

JSON::ParserError: 822: unexpected token at ''

Please help me to resolve this.
Thanks.

@Avdhesh51000 This is unrelated to Twurl itself. The reason you got the error is "POST media/upload (APPEND)" endpoint doesn't return any content body in response. This is documented:
https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload-append