Pagination controls

I’m still very new to all of this, and may have just not found it yet, but it seems to me that there is no standard representation of pagination controls defined by jsonapi. By this I mean when you are returning a single page of a larger resultset, and are indicating at least how many records in total there are available. (Often also included is the current page details - page number, starting offset and count of records - but the client should know those since it requested them)

Is there some standard for this? Official or otherwise? Given how thorough jsonapi seems it feels like a bizarre oversight…

The only standard on pagination I know are those written here :
That doesn’t include information like the count of records.

But maybe you could use the meta member in the pagination links (
For each pagination link (first, last, prev, next) and the self link, you would have the page numbern starting and ending offset. The count of records would be the ending offset of the last pagination link.

Does this suggestion make sense for your needs ?

It makes sense. My concern with the use of Meta elements like this is that it’s non-standard, which feels like it goes against the idea of JSONAPI, where everything works in a standard way making it much easier to have clients working with your server.

I’m also not seeing an easy way of supporting the client having different page sizes, but that might well just be functionality that doesn’t get supported. (It’s difficult to do well anyway, and generally there’s not as much benefit as there is cost)

I do like the idea of doing start and end offsets as meta elements on the pagination links, instead of just having a single overall count though.

To be specific, I’ve setup a Rails back-end using JSONAPI-Resources and it has a couple of pagination options including the ability to specify the page[size] and the page[number]. I am successfully using this information, along with the meta information concerning the total record count to paginate my Ember 2.x index/list views.

That might be too specific, but at least you could take a glance at the JSONAPI-Resources implementation for specific ideas. Let me know if that helps.