4

I have a RESTful API which could return a large number of items and I want to be able use pagination style techniques to limit the number of items, is this a good idea in a RESTful API?

If it is possible is best to do it via the link (url in this case) or part of the body of the request?

Cheers

AWC

1

1 Answer 1

6

Look at the Atom Feed Paging and Archiving RFC: https://www.rfc-editor.org/rfc/rfc5005 and also look at AtomPub itself (RFC5023).

You should be able to easily leverage that in your project.

Regarding theory: the API is RESTful if the media type of the representation (or some orthogonal specification - see below) tells the client where to find the paging links or how to construct them.

In the case of RFC5005 a number of link relations are defined (next,prev...) that are of course orthogonal to any media type. You find these link rels also in the IANA Link Relations Registry at http://www.iana.org/assignments/link-relations/link-relations.xml

Jan

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.