In iOS RestKit we have RKPaginator to implement paging. Do we have anything of that sort in RestLet to implement paging logic?
Thanks.
In iOS RestKit we have RKPaginator to implement paging. Do we have anything of that sort in RestLet to implement paging logic?
Thanks.
Restlet doesn't provide support for paging. It's a REST framework and you can leverage query parameters or headers to implement such feature. For more details, see the section "Filtering data" of this post: https://templth.wordpress.com/2014/12/15/designing-a-web-api/.
Hope it helps. Thierry
Maybe it's still helpful...
If you wanted to paginate a list of kid activities, your client executes a GET request to one of your end points. Let's say '/feeds/kids/activities'. The end point will return the following JSON document:
{
href: "http://localhost:8080/feeds/kids/activities",
offset: 0,
limit: 25,
sortBy: "createdAt",
sortOrder: "asc",
first: {
href: "http://localhost:8080/feeds/kids/activities?offset=0&limit=25&sortOrder=asc&sortBy=createdAt"
},
next: {
href: "http://localhost:8080/feeds/kids/activities?offset=25&limit=25&sortOrder=asc&sortBy=createdAt"
},
last: {
href: "http://localhost:8080/feeds/kids/activities?offset=47150&limit=25&sortOrder=asc&sortBy=createdAt"
},
items: [
{
_id: "55dc6064d6931a786b137acd",
name: "Coloring",
feedName: "kidActivity",
}
....
]
}
... if the next,last,first fields are defined, use the href property to callback for the subsecquent items. You would use URL parameters to configure the database query on the backend.
Lee Hazlewood did a video that I found useful.