From 459ddf583430f3b19bcc4dc40ceffef7180ca591 Mon Sep 17 00:00:00 2001 From: typicode Date: Sat, 10 Sep 2016 15:25:53 +0200 Subject: [PATCH] Add pagination --- README.md | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e44c612..b1ebfaa 100644 --- a/README.md +++ b/README.md @@ -85,16 +85,16 @@ GET /posts?id=1&id=2 GET /comments?author.name=typicode ``` -### Slice +### Paginate -Add `_start` and `_end` or `_limit` (an `X-Total-Count` header is included in the response) +Add `_page` and in the `Link` header you'll get `first`, `prev`, `next` and `last` links ``` -GET /posts?_start=20&_end=30 -GET /posts/1/comments?_start=20&_end=30 -GET /posts/1/comments?_start=20&_limit=10 +GET /posts?_page=7 ``` +_10 items are returned by default_ + ### Sort Add `_sort` and `_order` (ascending order by default) @@ -104,6 +104,16 @@ GET /posts?_sort=views&_order=DESC GET /posts/1/comments?_sort=votes&_order=ASC ``` +### Slice + +Add `_start` and `_end` or `_limit` (an `X-Total-Count` header is included in the response) + +``` +GET /posts?_start=20&_end=30 +GET /posts/1/comments?_start=20&_end=30 +GET /posts/1/comments?_start=20&_limit=10 +``` + ### Operators Add `_gte` or `_lte` for getting a range