我已閱讀Tumblr API V2文檔,並瞭解我可以使用/posts
方法和標籤參數從特定博客獲取具有特定標記的帖子,但我收到的回覆不包含任何帖子,只是總數。如何使用Tumblr API V2獲取特定博客的標記帖子?
這對我嘗試的任何博客和標籤組合都是正確的。我正在使用JavaScript(不是官方客戶端),但即使使用Tumblr API控制檯或直接在瀏覽器URL中輸入請求,結果也是一樣的。
實施例請求:
http://api.tumblr.com/v2/blog/washingtonpost.tumblr.com/posts/text?tag=culture&api_key=fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4
響應:
{"meta":{"status":200,"msg":"OK"},"response":{"blog":{"title":"The Washington Post","name":"washingtonpost","posts":2647,"url":"http:\/\/washingtonpost.tumblr.com\/","updated":1412647225,"description":"Things you should see and know, from civil rights to Senate races to sports to book reviews. Curated by Julia Carpenter.","is_nsfw":false,"ask":true,"ask_page_title":"Ask away!","ask_anon":true,"share_likes":false},"posts":[],"total_posts":7}}
response.total_posts
的計數是準確的,但爲什麼是response.posts
陣列空?我怎麼能使用這個迴應來獲得實際的職位?
編輯:
截至今天有對華盛頓郵報7個Posts部落格標記的「文化」。有1篇文章,3篇引文和3篇照片。
This request returns all 3 photo posts。
This request returns all 3 quote posts。
So why does this request not return the 1 text post?
經過進一步研究這似乎是當類型設置爲「文本」的的tumblr API中的錯誤。 API文檔中的這個示例按預期工作:http://api.tumblr.com/v2/blog/pitchersandpoets.tumblr.com/posts/photo?api_key=fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4&tag=new+york+yankees,但將類型從「photo 「到」文本「,你會得到空帖子數組:http://api.tumblr.com/v2/blog/pitchersandpoets.tumblr.com/posts/text?api_key=fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4&tag=new+york+yankees – 2014-10-07 09:51:24
顯然, total_posts count是針對具有任何類型*的指定標籤*的所有帖子,而不僅僅是被請求的類型。因此,當total_posts> 0時,可能不會獲得請求類型的帖子,但問題仍然存在,但我之前評論中的示例錯誤,因爲無論如何都沒有帶該標籤的文本帖子。 – 2014-10-07 10:19:59
看起來像一個錯誤。我會把問題提交給Tumblr。 – mikedidthis 2014-10-07 13:02:15