tumblr / tumblr.php

Tumblr API v2 PHP Client
Apache License 2.0
407 stars 115 forks source link

'type' parameter doens't work #69

Open KhanMaytok opened 8 years ago

KhanMaytok commented 8 years ago

The type parameter passed to to an request for post, causes that the 'post' response was a empty array

markl181 commented 8 years ago

can you provide the code you're using?

KhanMaytok commented 8 years ago

I'm using the api console provided in the Tumblr API page. I use

// Authenticate via API Key
$client = new Tumblr\API\Client('myhypersecretapi');

// Make the request
$client->getBlogPosts('khanmaytok.tumblr.com', array('type' => 'text', 'tag' => 'galaxy'));

I get

{
  "meta": {
    "status": 200,
    "msg": "OK"
  },
  "response": {
    "blog": {
      "title": "Maytok Blog",
      "name": "khanmaytok",
      "total_posts": 3,
      "posts": 3,
      "url": "http://khanmaytok.tumblr.com/",
      "updated": 1461278736,
      "description": "",
      "is_nsfw": false,
      "ask": false,
      "ask_page_title": "Ask me anything",
      "ask_anon": false,
      "share_likes": true,
      "likes": 6
    },
    "posts": [],
    "total_posts": 1
  }
}

The posts array is empty, but total_post is 1

Then, I erase the type parameter...

// Make the request
$client->getBlogPosts('khanmaytok.tumblr.com', array('tag' => 'galaxy'));

I get

{
  "meta": {
    "status": 200,
    "msg": "OK"
  },
  "response": {
    "blog": {
      "title": "Maytok Blog",
      "name": "khanmaytok",
      "total_posts": 3,
      "posts": 3,
      "url": "http://khanmaytok.tumblr.com/",
      "updated": 1461278736,
      "description": "",
      "is_nsfw": false,
      "ask": false,
      "ask_page_title": "Ask me anything",
      "ask_anon": false,
      "share_likes": true,
      "likes": 6
    },
    "posts": [
      {
        "blog_name": "khanmaytok",
        "id": 143186171980,
        "post_url": "http://khanmaytok.tumblr.com/post/143186171980/caliente",
        "slug": "caliente",
        "type": "text",
        "date": "2016-04-21 22:45:36 GMT",
        "timestamp": 1461278736,
        "state": "published",
        "format": "html",
        "reblog_key": "F9pYN1KX",
        "tags": [
          "maytok",
          "test",
          "galaxy"
        ],
        "short_url": "https://tmblr.co/ZFfKdh25MZvXC",
        "summary": "Caliente",
        "recommended_source": null,
        "recommended_color": null,
        "highlighted": [],
        "note_count": 0,
        "title": "Caliente",
        "body": "<p>Algo está naciendo justo ahora.</p>\n<p data-height=\"400\" data-theme-id=\"light\" data-slug-hash=\"dMevgO\" data-default-tab=\"result\" data-user=\"SakyaStelios\" data-embed-version=\"2\" class=\"codepen\">See the Pen <a href=\"http://codepen.io/SakyaStelios/pen/dMevgO/\">Galaxy</a> by Giancarlo Ventura (<a href=\"http://codepen.io/SakyaStelios\">@SakyaStelios</a>) on <a href=\"http://codepen.io\">CodePen</a>.</p>\n<script async=\"\" src=\"//assets.codepen.io/assets/embed/ei.js\"></script>",
        "reblog": {
          "tree_html": "",
          "comment": "<p><p>Algo está naciendo justo ahora.</p>\n<p data-height=\"400\" data-theme-id=\"light\" data-slug-hash=\"dMevgO\" data-default-tab=\"result\" data-user=\"SakyaStelios\" data-embed-version=\"2\" class=\"codepen\">See the Pen <a href=\"http://codepen.io/SakyaStelios/pen/dMevgO/\">Galaxy</a> by Giancarlo Ventura (<a href=\"http://codepen.io/SakyaStelios\">@SakyaStelios</a>) on <a href=\"http://codepen.io\">CodePen</a>.</p>\n<script async=\"\" src=\"//assets.codepen.io/assets/embed/ei.js\"></script></p>"
        },
        "trail": [
          {
            "blog": {
              "name": "khanmaytok",
              "active": true,
              "theme": {
                "header_full_width": 1080,
                "header_full_height": 720,
                "header_focus_width": 1080,
                "header_focus_height": 607,
                "avatar_shape": "circle",
                "background_color": "#FAFAFA",
                "body_font": "Helvetica Neue",
                "header_bounds": "56,1080,663,0",
                "header_image": "https://secure.static.tumblr.com/e2113e04cd331da27440a47a1d9201e3/dbvrzi8/ZwIo47drg/tumblr_static_b6jsisu9n6og4gcgwg4sgokcg.jpg",
                "header_image_focused": "https://secure.static.tumblr.com/e2113e04cd331da27440a47a1d9201e3/dbvrzi8/gK5o47dri/tumblr_static_tumblr_static_b6jsisu9n6og4gcgwg4sgokcg_focused_v3.jpg",
                "header_image_scaled": "https://secure.static.tumblr.com/e2113e04cd331da27440a47a1d9201e3/dbvrzi8/ZwIo47drg/tumblr_static_b6jsisu9n6og4gcgwg4sgokcg_2048_v2.jpg",
                "header_stretch": true,
                "link_color": "#529ECC",
                "show_avatar": true,
                "show_description": true,
                "show_header_image": true,
                "show_title": true,
                "title_color": "#444444",
                "title_font": "Gibson",
                "title_font_weight": "bold"
              },
              "share_likes": true,
              "share_following": true
            },
            "post": {
              "id": "143186171980"
            },
            "content_raw": "<p><p>Algo está naciendo justo ahora.</p>\n<p data-height=\"400\" data-theme-id=\"light\" data-slug-hash=\"dMevgO\" data-default-tab=\"result\" data-user=\"SakyaStelios\" data-embed-version=\"2\" class=\"codepen\">See the Pen <a href=\"http://codepen.io/SakyaStelios/pen/dMevgO/\">Galaxy</a> by Giancarlo Ventura (<a href=\"http://codepen.io/SakyaStelios\">@SakyaStelios</a>) on <a href=\"http://codepen.io\">CodePen</a>.</p>\n<script async=\"\" src=\"//assets.codepen.io/assets/embed/ei.js\"></script></p>",
            "content": "<p>Algo está naciendo justo ahora.</p>\n<p>See the Pen <a href=\"http://codepen.io/SakyaStelios/pen/dMevgO/\">Galaxy</a> by Giancarlo Ventura (<a href=\"http://codepen.io/SakyaStelios\">@SakyaStelios</a>) on <a href=\"http://codepen.io\">CodePen</a>.</p>\n<p><a href=\"#\"><img src=\"https://secure.assets.tumblr.com/images/inline_placeholder.png\" width=\"18\" height=\"14\"/></a></p>",
            "is_current_item": true,
            "is_root_item": true
          }
        ]
      }
    ],
    "total_posts": 1
  }
}
ceyko commented 8 years ago

@KhanMaytok I've checked into this a bit and it is indeed an issue on the backend, specifically when requesting text posts along with filtering by tag. I've filed a bug internally and should have a fix shortly.

Good catch, thanks!