Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/posts: Broken pagination with sort: asc #137

Open
marcustyphoon opened this issue Aug 29, 2024 · 1 comment
Open

/posts: Broken pagination with sort: asc #137

marcustyphoon opened this issue Aug 29, 2024 · 1 comment

Comments

@marcustyphoon
Copy link
Contributor

When using the new sort: asc option on the posts endpoint, a pagination links object is included, but it doesn't actually allow the user to paginate through all of the results, presumably because it's starting from the "end" but is still paginating in descending order.

For example:

curl "https://api.tumblr.com/v2/blog/april/posts?sort=asc&api_key=[removed]"

{
  "meta": {
    "status": 200,
    "msg": "OK"
  },
  "response": {
    "blog": { ... },
    "posts": [ ... ],
    "total_posts": 76220,
    "_links": {
      "next": {
        "href": "/v2/blog/april/posts?sort=asc&tumblelog=april&page_number=VBhXtG4VJ38EJGXha1bRQ01EutiCQ2UjxAbGwDcW2YxDWDlTMDdVSlBzalpnNEJ2bnBwMk1LLzl4eERjUnJoUkFNdysyWWoyNjdNWnR4S2dieGU5aFR5T3JFMVptb0s4aUg5QnE5c0RoTHBETXB0TnNBTElTK0F0c0JXTHJPZkVhaFVlRkZaL3NVRkhXcVF5VVJJcWhEMXRudUNoNFFhaXZxaWlKaXB5MkJUZHJxR1YrdFVjMkdzUTJCT3B0engvNGM4dU5McjZtSlIwd1dlZVFtRVlMSTM4MG8wb0JuL0ZJVDFpUmoyTHQwU3g1UHRxM241NlBQOXh3amNBU1Z4Z1A0SkJzTWJ5b25TT0VXbzlydTNXL1dQd3JPa2tjK1dadW5FNXM4bkcrVU51YWpYT1VCbWJ1MVUrcjlheVg2M3Z1VWNvSVpJVE9mMTBkUnU1ckc4WVJsb3JjWmp4REh3WmpCcTRyUk96WWhIYVlCejgwQkcrN0JFUG5hekJmQWZMcmxJQW5xZUpJbnhsTUF0Q2xMRnZobkd0N3BLRnBIN2Q2SmtHaW4vc3BsVU54b3pDaFUvaDZtdz09",
        "method": "GET",
        "query_params": {
          "sort": "asc",
          "tumblelog": "april",
          "page_number": "VBhXtG4VJ38EJGXha1bRQ01EutiCQ2UjxAbGwDcW2YxDWDlTMDdVSlBzalpnNEJ2bnBwMk1LLzl4eERjUnJoUkFNdysyWWoyNjdNWnR4S2dieGU5aFR5T3JFMVptb0s4aUg5QnE5c0RoTHBETXB0TnNBTElTK0F0c0JXTHJPZkVhaFVlRkZaL3NVRkhXcVF5VVJJcWhEMXRudUNoNFFhaXZxaWlKaXB5MkJUZHJxR1YrdFVjMkdzUTJCT3B0engvNGM4dU5McjZtSlIwd1dlZVFtRVlMSTM4MG8wb0JuL0ZJVDFpUmoyTHQwU3g1UHRxM241NlBQOXh3amNBU1Z4Z1A0SkJzTWJ5b25TT0VXbzlydTNXL1dQd3JPa2tjK1dadW5FNXM4bkcrVU51YWpYT1VCbWJ1MVUrcjlheVg2M3Z1VWNvSVpJVE9mMTBkUnU1ckc4WVJsb3JjWmp4REh3WmpCcTRyUk96WWhIYVlCejgwQkcrN0JFUG5hekJmQWZMcmxJQW5xZUpJbnhsTUF0Q2xMRnZobkd0N3BLRnBIN2Q2SmtHaW4vc3BsVU54b3pDaFUvaDZtdz09"
        }
      }
    }
  }
}                                                                                                                    

and then:

curl "https://api.tumblr.com/v2/blog/april/posts?sort=asc&tumblelog=april&page_number=VBhXtG4VJ38EJGXha1bRQ01EutiCQ2UjxAbGwDcW2YxDWDlTMDdVSlBzalpnNEJ2bnBwMk1LLzl4eERjUnJoUkFNdysyWWoyNjdNWnR4S2dieGU5aFR5T3JFMVptb0s4aUg5QnE5c0RoTHBETXB0TnNBTElTK0F0c0JXTHJPZkVhaFVlRkZaL3NVRkhXcVF5VVJJcWhEMXRudUNoNFFhaXZxaWlKaXB5MkJUZHJxR1YrdFVjMkdzUTJCT3B0engvNGM4dU5McjZtSlIwd1dlZVFtRVlMSTM4MG8wb0JuL0ZJVDFpUmoyTHQwU3g1UHRxM241NlBQOXh3amNBU1Z4Z1A0SkJzTWJ5b25TT0VXbzlydTNXL1dQd3JPa2tjK1dadW5FNXM4bkcrVU51YWpYT1VCbWJ1MVUrcjlheVg2M3Z1VWNvSVpJVE9mMTBkUnU1ckc4WVJsb3JjWmp4REh3WmpCcTRyUk96WWhIYVlCejgwQkcrN0JFUG5hekJmQWZMcmxJQW5xZUpJbnhsTUF0Q2xMRnZobkd0N3BLRnBIN2Q2SmtHaW4vc3BsVU54b3pDaFUvaDZtdz09&api_key=[removed]"

{
  "meta": {
    "status": 200,
    "msg": "OK"
  },
  "response": {
    "blog": { ... },
    "posts": [],
    "total_posts": 76220
  }
}
@cyle
Copy link
Member

cyle commented Sep 9, 2024

thanks for reporting this, i've filed an internal ticket for someone to look into this a little more! i think part of the problem is that it's actually supposed to add a "prev" link, since you're paginating "backwards"... which is a little weird to wrap my head around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants