tumblr / tumblr_client

A Ruby Wrapper for the Tumblr v2 API
Apache License 2.0
224 stars 86 forks source link

video does not upload? #45

Closed jronallo closed 9 years ago

jronallo commented 9 years ago

When uploading a video I get the following error: {"status"=>400, "msg"=>"Bad Request", "errors"=>["Error uploading video file."]}

Code is simply:

video_path = '/path/to/video.mp4'
client = Tumblr::Client.new(:client => :httpclient)
client.video("#{username}.tumblr.com", {data: [video_path], caption: caption})

If I remove the caption the error becomes the following which leads me to believe the video is never uploaded: {"status"=>400, "msg"=>"Bad Request", "errors"=>["Error uploading video file.", "Post cannot be empty."]}

Uploading the same video through the web interface and the video post is successful. Uploading photos using similar code works just fine.

Using: tumblr_client 0.8.5 faraday 0.9.1 faraday_middleware 0.9.1 httpclient 2.5.3.3

jronallo commented 9 years ago

Figured it out I think. Video post does not expect data to be an Array. It should instead by a string like this:

client.video("#{username}.tumblr.com", {data: video_path, caption: caption})