Iβve been checking on many issues and the docs but there seem to be no clear answer.
Is it possible to paginate the results on a get entries of a collection ?
something like:
fetch('/api/collections/collection/posts?page=1&entries=10&token=xxtokenxx')
.then(collection => collection.json())
.then(collection => console.log(collection)); // only 10 returned
OR
fetch('/api/collections/collection/posts?take=10&skip=0&token=xxtokenxx')
.then(collection => collection.json())
.then(collection => console.log(collection)); // only 10 returned
thanks, itβs very helpful.
Itβs pretty weird to do a post request to retreive data though, why is it like that? Itβs not really respectful of the rest standards, do you know why itβs like that?
artur
April 17, 2019, 2:45pm
4
you can also do a GET request, e.g:
fetch('/api/collections/collection/posts?limit=10&skip=10&token=xxtokenxx')
post is nice because of the possible usage of a json body
yes I saw that later on.
Well yes the post lets you use the json body but post is meant to create / add data not retreive it, so it creates confusion.
Also, using something like axios itβs quite simple to parse data to url.
Thanks.