feedbin / feedbin-api

Feedbin API Documentation
349 stars 26 forks source link

Missing pagination headers #45

Closed endquote closed 3 years ago

endquote commented 4 years ago

I'm noticing that the links header doesn't always appear when it should.

For example when I load a search from https://api.feedbin.com/v2/saved_searches/8259.json, the links header says:

<https://api.feedbin.com/v2/saved_searches/8259.json?page=2>; rel="next", <https://api.feedbin.com/v2/saved_searches/8259.json?page=23>; rel="last"

So it looks like there are 23 pages. If I load each page, I notice that the header disappears at page 6:

1 https://api.feedbin.com/v2/saved_searches/8259.json <https://api.feedbin.com/v2/saved_searches/8259.json?page=2>; rel="next", <https://api.feedbin.com/v2/saved_searches/8259.json?page=23>; rel="last"

2 https://api.feedbin.com/v2/saved_searches/8259.json?page=2 <https://api.feedbin.com/v2/saved_searches/8259.json?page=1>; rel="first", <https://api.feedbin.com/v2/saved_searches/8259.json?page=1>; rel="prev", <https://api.feedbin.com/v2/saved_searches/8259.json?page=3>; rel="next", <https://api.feedbin.com/v2/saved_searches/8259.json?page=23>; rel="last"

3 https://api.feedbin.com/v2/saved_searches/8259.json?page=3 <https://api.feedbin.com/v2/saved_searches/8259.json?page=1>; rel="first", <https://api.feedbin.com/v2/saved_searches/8259.json?page=2>; rel="prev", <https://api.feedbin.com/v2/saved_searches/8259.json?page=4>; rel="next", <https://api.feedbin.com/v2/saved_searches/8259.json?page=23>; rel="last"

4 https://api.feedbin.com/v2/saved_searches/8259.json?page=4 <https://api.feedbin.com/v2/saved_searches/8259.json?page=1>; rel="first", <https://api.feedbin.com/v2/saved_searches/8259.json?page=3>; rel="prev", <https://api.feedbin.com/v2/saved_searches/8259.json?page=5>; rel="next", <https://api.feedbin.com/v2/saved_searches/8259.json?page=23>; rel="last"

5 https://api.feedbin.com/v2/saved_searches/8259.json?page=5 <https://api.feedbin.com/v2/saved_searches/8259.json?page=1>; rel="first", <https://api.feedbin.com/v2/saved_searches/8259.json?page=4>; rel="prev", <https://api.feedbin.com/v2/saved_searches/8259.json?page=6>; rel="next", <https://api.feedbin.com/v2/saved_searches/8259.json?page=23>; rel="last"

6 https://api.feedbin.com/v2/saved_searches/8259.json?page=6 undefined

7 https://api.feedbin.com/v2/saved_searches/8259.json?page=7 undefined

So in my code I'm only looking at the header the first time, and counting up to the "last" value.

kunalsood commented 3 years ago

Adding to this issue: Fetching anything beyond page number 5 (for saved search https://api.feedbin.com/v2/saved_searches/10159.json that returned last page number of 22, and X-Feedbin-Record-Count of 2113 in the first page) results in an empty response & Status Code: 200.

Additionally, fetching anything beyond page number 100 (for saved search https://api.feedbin.com/v2/saved_searches/10161.json that returned last page number of 1080, and X-Feedbin-Record-Count of 107994 in the first page) results in Status Code: 500.

So, as it stands right now, with the Saved Searches endpoints, we can only fetch the first 5 pages max. Pages 6-100 return empty responses, and pages 101 & above return 500 Internal Server Error.

benubois commented 3 years ago

This should be fixed now see #56.