Skip to content

Commit 27a91bb

Browse files
committed
Fix skipping doc
1 parent db6ef5b commit 27a91bb

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

README.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The REST Layer framework is composed of several sub-packages:
4747
- [Field Parameters](#field-parameters)
4848
- [Embedding](#embedding)
4949
- [Pagination](#pagination)
50+
- [Skipping](#skipping)
5051
- [Authentication & Authorization](#authentication-and-authorization)
5152
- [Conditional Requests](#conditional-requests)
5253
- [Data Integrity & Concurrency Control](#data-integrity-and-concurrency-control)
@@ -854,21 +855,6 @@ Here we sort the result by ascending quantity and descending date:
854855

855856
/posts?sort=quantity,-created
856857

857-
## Skipping
858-
859-
Skipping of resource items is defined through the `skip` query-string parameter. The `skip` value is a positive integer defining the number of items to skip when querying for items.
860-
861-
To use a resource field with the `skip` parameter, the field must be defined on the resource.
862-
863-
Skip the first 10 items of the result:
864-
865-
/posts?skip=10
866-
867-
Return the first 2 items after skipping the first 10 of the result:
868-
869-
/posts?skip=10&limit=2
870-
Note that `skip` can't be used with pagination.
871-
872858
## Field Selection
873859

874860
REST APIs tend to grow over time. Resources get more and more fields to fulfill the needs for new features. But each time fields are added, all existing API clients automatically gets the additional cost. This tend to lead to huge wast of bandwidth and added latency due to the transfer of unnecessary data.
@@ -1018,10 +1004,34 @@ Such request can quickly generate a lot of queries on the storage handler. To en
10181004

10191005
## Pagination
10201006

1021-
Pagination is supported on collection URLs using `skip`, `page` and `limit` query-string parameters. If you don't define a default pagination limit using `PaginationDefaultLimit` resource configuration parameter, the resource won't be paginated until you provide the `limit` query-string parameter.
1007+
Pagination is supported on collection URLs using `page` and `limit` query-string parameters. If you don't define a default pagination limit using `PaginationDefaultLimit` resource configuration parameter, the resource won't be paginated until you provide the `limit` query-string parameter.
10221008

10231009
If your collections are large enough, failing to define a reasonable `PaginationDefaultLimit` parameter may quickly render your API unusable.
10241010

1011+
## Skipping
1012+
1013+
Skipping of resource items is defined through the `skip` query-string parameter. The `skip` value is a positive integer defining the number of items to skip when querying for items.
1014+
1015+
To use a resource field with the `skip` parameter, the field must be defined on the resource.
1016+
1017+
Skip the first 10 items of the result:
1018+
1019+
/posts?skip=10
1020+
1021+
Return the first 2 items after skipping the first 10 of the result:
1022+
1023+
/posts?skip=10&limit=2
1024+
1025+
The `skip` parameter can be used in conjunction with the `page` parameter. You may want them both when for instance, you show the first N elements of a list and then allow to paginate the remaining items:
1026+
1027+
Show the first 2 elements:
1028+
1029+
/posts?limit=2
1030+
1031+
Paginate the rest of the list:
1032+
1033+
/posts?skip=2&page=1&limit=10
1034+
10251035
## Authentication and Authorization
10261036

10271037
REST Layer doesn't provide any kind of support for authentication. Identifying the user is out of the scope of a REST API, it should be performed by an oAuth server. The oAuth endpoints could be either hosted on the same code base as your API or live in a different app. The recommended way to integrate oAuth or any other kind of authentication with REST Layer is through a signed token like [JWT](https://jwt.io).

0 commit comments

Comments
 (0)