Closed joesb closed 9 years ago
Can you explain how this pager functionality works? How would I pull a list of ALL blog posts, sorted by date?
Ok, rebase done and I've added a slight adaptation to the view so that you can choose the items per page to be displayed. Just add the query item:
?items_per_page={number/All}
Default is 10 (i.e. with no parameter in the query, 10 most blog entries will be returned [in reverse date order], with offset taken from the page={page_number} URL query parameter).
In most circumstances, I'd suggest, it probably would make sense for subscribing sites to just request the default number (or a chosen number per page) and use the pager option in the API, rather than pull in a massive list of ALL the blogs and then slice off the number wanted and throw away the rest.
Ok thanks, I will test this.
In most circumstances, I'd suggest, it probably would make sense for subscribing sites to just request the default number (or a chosen number per page) and use the pager option in the API, rather than pull in a massive list of ALL the blogs and then slice off the number wanted and throw away the rest.
How would a subscribing site know how many new blog posts there are? Would they know they only need the most recent 10? I am assuming we would have a solution that caches these results, so every page doesn't take an age to load.
How would a subscribing site know how many new blog posts there are?
Good point. Hmm. Needs more thought.
If the default to items_per_page
is all
then maybe this solves the problem.
Looking at http://explorer.content.guardianapis.com/search?api-key=test as an example; Maybe it's worth just specifying from and to dates as parameters?
With no count setting (i.e. by default) http://content.guardianapis.com/search?api-key=test, though, returns 10 items, not all/everything.
Yes that's true, and then they use startindex to say where to start the items from. I guess that's the same as our pager implementation but with slightly different wording. Ok this is good I think.
:+1:
This is the first draft of blog support functionality only. Adds blog content type, with fields for:
API endpoints at: