Nov 10, 2018

Example of Tumblr photo post by API using Java

Tumblr API is very easy to use. Here is an example of Tumblr photo post by API using Java.
package ca.i88.tumblr;

import com.tumblr.jumblr.JumblrClient;
import com.tumblr.jumblr.types.PhotoPost;
import java.io.IOException;

/**
 *
 * @author i88.ca
 */
public class TumblrPhotoPostByAPI {

    public static void main(String[] args) throws IllegalAccessException, InstantiationException, IOException {
        final String Consumer_Key = "";
        final String Consumer_Secret = "";
        final String Oauth_token = "";
        final String Oauth_token_secret = "";
        // Create a new client
        JumblrClient client = new JumblrClient(Consumer_Key, Consumer_Secret);
        client.setToken(Oauth_token, Oauth_token_secret);

        PhotoPost post = client.newPost("tumblr.i88.ca", PhotoPost.class);
        post.setSource("http://it.i88.ca/interesting.jpg");
        post.setLinkUrl("http://i88.ca");
        post.save();
    }
}