Search code examples
javatagsfetchtumblr

java code to get all posts from Tumblr using the tag name


I have tried to get the posts from Tumblr using the tag.

http://api.tumblr.com/v2/tagged?tag=hadoop&api_key=*****

I can write HTTP client and can get the json and parse accordingly. But i want to know information like any supported tumblr java api to access this.

I tried with com.tumblr.jumblr.JumblrClient but i didnot found any method which supports this requirement. Can any one suggest me in this.


Solution

  • I Found It..

    public List<Post> fetchPostsByTag(JumblrClient client, String tagName, long timestamp) {
        if (client == null || tagName == null || tagName.isEmpty()) {
            return null;
        }
        Map<String, String> options = new HashMap<String, String>();
        if (timestamp != 0) {
            options.put("before", timestamp + "");
        }
        List<Post> posts = client.tagged(tagName, options);
        return posts;
    }
    

    This code is worked for me .. now i am getting more than 20 posts using tag.

    Thanks Reins for support.