api returning wrong number of posts (limit)

148 views
Skip to first unread message

Walid Wannous

unread,
Jul 9, 2012, 12:17:06 PM7/9/12
to tumbl...@googlegroups.com
Calling http://api.tumblr.com/v2/blog/toucheydesign.tumblr.com/posts?api_key=9ETjA------------------------------------------JtQewBmeFIM&tag=photography&offset=1&limit=10 
returns only 7 posts in the json although i have specified a limit of 10 and the total posts is 49 as mentioned in the json file.

Felix Bonkoski

unread,
Jul 11, 2012, 12:18:09 AM7/11/12
to tumbl...@googlegroups.com
These are know bugs

  1. When you request a limit of X posts, the API may not return exactly X posts.

    I think this has to do with posts that have been deleted / marked private on a blog. The API "skips" over them, but instead of filling in the missing posts with more posts, it just returns some number <= X.

    As such, you should *never* use the number of posts returned from the .../blog/<host>/posts  call when you set the Offset parameter to fetch more.

    Eg,
    Suppose you fetch offset=0, limit=10  and you get 7 posts back. 
    On your next call to fetch more posts, you *still use* offset=10, limit=10  and NOT  offset=7, limit=10


  2. The "total posts" number you refer to is *Not* the number of posts *returned* by the call to .../blog/<host>/posts

    It is meant to be the "total number of posts on this blog"

    However, *note* there is another known bug here!  The number returned for "Total Posts" is often incorrect!

    So do not depend on this number when you are paginating through posts, to determine if you reached the end!

Felix



On Mon, Jul 9, 2012 at 11:17 AM, Walid Wannous <wwan...@koein.com> wrote:
Calling http://api.tumblr.com/v2/blog/toucheydesign.tumblr.com/posts?api_key=9ETjA------------------------------------------JtQewBmeFIM&tag=photography&offset=1&limit=10 
returns only 7 posts in the json although i have specified a limit of 10 and the total posts is 49 as mentioned in the json file.



--
Felix Bonkoski

Walid Wannous

unread,
Jul 11, 2012, 3:04:53 AM7/11/12
to tumbl...@googlegroups.com
Felix,
Thank you for your reply. Ill try to work around these bugs. Is there any plan to fix these bugs any soon?


John Bunting

unread,
Jul 12, 2012, 9:57:49 AM7/12/12
to tumbl...@googlegroups.com
Hey Walid,

We are aware of the bug and it's been filed. It's on the road map to fix but some other things have been pushed in front of it.

Thanks for the email!

-- 
John Bunting

Simplicity is a prerequisite for reliability
   --Edsger W. Dijkstra

Reply all
Reply to author
Forward
0 new messages