Advanced Queries: Pagination
Every REST resource in Structr supports two keywords that control the number of elements that are returned for a given REST call: page
and pageSize
.
The page
keyword selects the index of the desired page (starting from 1), and the pageSize
keyword controls the number of elements each page is comprised of.
$ curl -si -HX-User:admin -HX-Password:admin "http://localhost:8082/structr/rest/files?pageSize=10&page=3
Response:
HTTP/1.1 200 OK
Set-Cookie: JSESSIONID=xkn5bvu0vt3h124xf8c9w7a8x;Path=/
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: application/json; charset=utf-8
Vary: Accept-Encoding, User-Agent
Transfer-Encoding: chunked
Server: Jetty(9.1.3.v20140225)
{
"page": 3,
"page_size": 10,
"page_count": 353,
"query_time": "0.004941183",
"result_count": 3522,
"result": [...],
"serialization_time": "0.000527189"
}