1

I feel like I'm missing something obvious, but I cannot seem to figure it out. I need to figure out from a given URL to a tumblr blogpost, if the blog this was posted on "is nsfw".

The API console suggests that information can be found via Blog: Info "This method returns general information about the blog, such as the title, number of posts, and other high-level data"

The Java code example in the console using the JumblrClient is the following

// Authenticate via API Key
JumblrClient client = new JumblrClient("AUTH");
// Make the request
Blog blog = client.blogInfo("asksunshineandmoonbeams");

and the example output does indeed contain that flag is_nsfw

{
  "meta": {
    "status": 200,
    "msg": "OK"
  },
  "response": {
    "blog": {
      "title": "Ask Sunshine and Moonbeams",
      "name": "asksunshineandmoonbeams",
      "posts": 106,
      "url": "http://asksunshineandmoonbeams.tumblr.com/",
      "updated": 1455995792,
      "description": "Sisterly love at its finest.",
      "is_nsfw": false,
      "ask": true,
      "ask_page_title": "Give us stuff to do ^^",
      "ask_anon": true,
      "submission_page_title": "Any gifts for us? :3",
      "share_likes": true,
      "likes": 230
    }
  }
}

But it seems the Blog object created in Java above does not seem to offer that information? The javadoc also doesn't list any way to obtain that http://tumblr.github.io/jumblr/javadoc/index.html?com/tumblr/jumblr/JumblrClient.html

So, is there another way to get the state of that flag with the JumblrClient or will I have to go another route?

Pinkie Pie
  • 688
  • 7
  • 15
  • Why not contributing a pull request to the project? See https://github.com/tumblr/jumblr/pull/80 as example for another missing field. Instead of Post.java, you would add fields to Blog.java – Stanley F. Mar 09 '16 at 15:19

1 Answers1

0

So, turns out this really is not supported by the JumblrClient, currently.

If anyone else stumbles across this until it is resolved in a new version, I now ended up getting that info by querying directly via api.tumblr.com/v2/blog/{blog-identifier}/info?api_key={key} as described here https://www.tumblr.com/docs/en/api/v2#blog-info

So for the example above https://api.tumblr.com/v2/blog/asksunshineandmoonbeams.tumblr.com/info?api_key={key} yields the JSON as seen in the question.

Pinkie Pie
  • 688
  • 7
  • 15