Closed bennworks closed 1 year ago
Hey @bennworks -- we'll take a look at this and get back to you about this and #87, they're likely related. Thank you for all of the detail here!
Hey @bennworks -- we'll take a look at this and get back to you about this and #87, they're likely related. Thank you for all of the detail here!
It's been a month already. I wonder when it will be resolved.
Hi @cyle I'm still desperately waiting for this issue to be resolved. Also, please check if the cause of the problem is because "oauth 1" is used.
I've also been struggling with this while implementing an NPF post creation method for Tumblr.js (https://github.com/tumblr/tumblr.js/issues/165).
Basic post creation works fine, but as soon as I try to upload media as part of the request is fails.
I've been following the documentation here:
In order to support user uploaded media (photos, videos, etc.), the creation and edit routes also support a multi-part form request where the first part contains the JSON body and subsequent parts contain media data. The Content-Type: multipart/form-data header must be used in this case.
To specify which media data pertains to which block, we use a unique identifier in the JSON body and this identifier is used as the key in the form data. …
--TumblrBoundary Content-Disposition: form-data; name="json" Content-Type: application/json {JSON encoded parameters} --TumblrBoundary Content-Disposition: form-data; name="some-identifier"; filename="filename.jpg" Content-Type: image/jpeg {image data} --TumblrBoundary--
I was able to get this working for tumblr.js
, there's an integration test example with a video upload. The request we send looks a lot like the example you shared @bennworks. Were you able to get this working?
If you're using Node.js, you might try with a v4 release of tumblr.js (currently prerelease, but available on npm tagged next
).
Thank @sirreal for providing information. Unfortunately, I'm still stuck with this issue. I'm developing in mobile platform. So I can't use tumblr.js. BTW, do you use oAuth1 or oAuth2? I'm using oAuth1 and I'm wondering if the authentication method has anything to do with this issue.
Error 400 probably means authentication method is not the problem.
I've been using oauth1 to successfully create NPF posts.
@bennworks one idea is to capture a request made using tumblr.js to create a post, then compare that with your requests.
How big are the videos? Size, length, etc. There are limits on videos described here: https://help.tumblr.com/hc/en-us/articles/231455628-Posting-Video
Are you able to upload the same videos via the web editor?
@sirreal I've tested various video files such as exact video downloaded from Tumblr, small size etc. I have no problem in uploading multipart image data with the same module. And I have captured the upload data stream for various apps(mine and Tumblr one). Captured data shows no problem.
@cyle , @sirreal I found the cause of this bug finally. The media property of video content is not 'Array' type. It's a single entity with {} only. After removing array, video upload works normally. I use same module for image/video, so I didn't notice until now. Thank you for your help so far.
The multipart form request is failing when creating a new post containing a video file. The returned error is following.
But detail is changing slightly whenever making a new request like this:
My multipart form request is as following.
PS. Additionally, when posting image files using the same method, it succeeds. The multipart form request is nearly the same content except Content-Type and file data.