wunderio / wunderhub

A central content repository for the WunderSites.
http://docs.wunderhub.apiary.io/
GNU General Public License v2.0
3 stars 3 forks source link

Add support for blogs from the WunderHub #26

Closed joesb closed 9 years ago

joesb commented 9 years ago

This is the first draft of blog support functionality only. Adds blog content type, with fields for:

API endpoints at:

lewisnyman commented 9 years ago

Can you explain how this pager functionality works? How would I pull a list of ALL blog posts, sorted by date?

joesb commented 9 years ago

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.

lewisnyman commented 9 years ago

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.

joesb commented 9 years ago

How would a subscribing site know how many new blog posts there are?

Good point. Hmm. Needs more thought.

lewisnyman commented 9 years ago

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?

joesb commented 9 years ago

With no count setting (i.e. by default) http://content.guardianapis.com/search?api-key=test, though, returns 10 items, not all/everything.

lewisnyman commented 9 years ago

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.

joesb commented 9 years ago

:+1: