The Jumblr API gives a bad request when sending an image to Tumblr

What i have

I have image File objectone that is trying to send a message TumblrusingJumblr API

My problem

When I try to post an image, I get com.tumblr.jumblr.exceptions.JumblrException: invalid request. Response Code: 400

My code

client = new JumblrClient(CONSUMER_KEY,SECRET_KEY);
                            client.setToken(TOKEN, TOKEN_SECRET);
                            User user=client.user();
                            userName=user.getName();

                            PhotoPost photoPost=client.newPost(client.user().getBlogs().get(0).getName(),PhotoPost.class);
                            photoPost.setCaption("My Tumblr post");


                            photoPost.setPhoto(new Photo(Methods.FILE_IMAGE));
                            photoPost.save();
+4
source share
2 answers

I had a similar issue with publishing video and audio. However, placing the image worked like a charm.

JumblrClient client = new JumblrClient(
                CONSUMER_KEY,
                SECRET_KEY
        );
client.setToken(
                TOKEN,
                TOKEN_SECRET
        );
PhotoPost post = client.newPost(strBlogName, PhotoPost.class);
post.setCaption("This is my caption");
post.setData(new File(fileUri.getPath()));
post.save(); //Initiates upload of image file
0
source

I ran into the same problem using Jumblr.

( - Android? javadoc Methods.FILE_IMAGE)

photoPost.setPhoto(new Photo(Methods.FILE_IMAGE));

photoPost.setData(new File(fileName)); //if it possible on Android

: Tumblr , . ~ 3% gif , throw : 400. GIF, , Tumblr - , , , post.setData , - , .

0

Source: https://habr.com/ru/post/1621455/


All Articles