- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I have started getting 502 Bad Gateway errors when paginating using the "next" link from the API response body, when "limit" is not initially set to a factor of the total items.
I was successfully paginating with a "limit" of 49, which allowed me to get 49 more items beyond the stated total:
- /me/top/{type}?limit=49 ("next" link /me/top/{type}?offset=49&limit=49)
- /me/top/{type}?offset=49&limit=49 ("next" link /me/top/{type}?offset=98&limit=49)
- /me/top/{type}?offset=98&limit=49 (no "next" link)
Now, I get a 502 Bad Gateway error for the last request to /me/top/{type}?offset=98&limit=49, despite the API providing the link.
When paginating in this way, this is only an issue for a "limit" which is not a factor of 100 (total number of items). You can see that for a "limit" of something that is a factor, like 25, there is no "next" link for the final response body:
- /me/top/{type}?limit=25 ("next" link /me/top/{type}?offset=25&limit=25)
- /me/top/{type}?offset=25&limit=25 ("next" link /me/top/{type}?offset=50&limit=25)
- /me/top/{type}?offset=50&limit=25 ("next" link /me/top/{type}?offset=75&limit=25)
- /me/top/{type}?offset=75&limit=25 (no "next" link)
For more context, see this related topic and this GItHub issue.
Solved! Go to Solution.
- Labels:
-
502 Bad Gateway
-
Possible Bug
-
Top Items
-
Web API
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page