tumblr / docs

Tumblr's public platform documentation.
Apache License 2.0
109 stars 27 forks source link

total_posts field reflects total number of posts on blog when filtering by tag #54

Closed cubeghost closed 3 years ago

cubeghost commented 3 years ago

Hi there!

While investigating a recent increase in rate limiting errors, I found that my requests to /v2/blog/{blog}/posts?tag= were coming back with an incorrect total_posts value. Instead of reflecting the number of posts with the given tag, it's the total number of posts on the blog. When passing just the type query param, it behaves correctly.

A lot of older API applications use this field for pagination- in my case, the incorrect value is causing the pagination logic to make as many API calls as there are pages on a given blog, often causing rate limiting errors. I'd like to migrate to using _links anyway since it provides more consistency across endpoints, but regardless, this seems like an unexpected behavior.

Example: https://api.tumblr.com/v2/blog/cubeghost.tumblr.com/posts?tag=gif There are only 4 posts in this tag, but total_posts is 364, the total number of posts on the blog.

cyle commented 3 years ago

Hello! Looks like you've discovered a bug here. We've been updating this endpoint a lot lately to make it more efficient (and potentially add some new filtering options), and it looks like this field got broken in the process. We'll update this issue when we've rolled out a fix. Thanks for reporting!

cubeghost commented 3 years ago

thanks for the update!

cyle commented 3 years ago

Hey @cubeghost -- can you check on this now? I believe we should have a fix in place for this as of about an hour ago.

cubeghost commented 3 years ago

@cyle looks good! 🎉