RE: Pagination (ISSUE-42)

Markus, Tomasz

 

I feel both of you are right.

 

Indeed I feel that we don't need a very special way of describing pagination
to client. I think Hydra has already what is needed to do this.

 

>From my experience, in most cases pagination is a call to same resources
with extra parameters, defining either page+page size or offset+limit. From
that point of view, I think templated links are good enough to address that.
With two extra predicates with special meaning for page and page size notion
(offset and limit can be easily calculated from each other) client will be
informed how to craft the url to call a page of a collection. This pattern
is already used for 'freetextQuery', where it has a special meaning not
really bound to any resource property.

 

Client doesn't need to know exact number of possible pages - in worst case
scenario it will receive either an empty page or some other non 2XX
response. Still, if needed this number can be provided with the response of
the i.e. first page (which is usually called at the beginning).

 

This approach won't need any special treating of collections and pages, and
server will define whether the collection is actually pageable by providing
a IriTemplate and templated links.

 

What do you think about this?

 

Regards

 

Karol

Received on Friday, 13 February 2015 09:01:30 UTC