OnePost

FREEMIUM
By Adam Darrah | Updated לפני חודש | Social
Popularity

8.5 / 10

Latency

954ms

Service Level

100%

Health Check

N/A

Back to All Tutorials (10)

Working with Pagination

OnePost will paginate when you make a request to an API endpoint that returns many results (mainly index endpoints) to keep requests quick. The default options for these requests are to fetch the first 30 results (per_page = 30) of the first page (page = 1). You can see an example of that with this request:

curl --request GET \
> --url 'https://onepost1.p.rapidapi.com/api/v1/events?secret_key=sk-cbe...' \
> --header 'x-rapidapi-host: onepost1.p.rapidapi.com' \
> --header 'x-rapidapi-key: 9d0...'

{"current_page":1,"per_page":30,"total_entries":31,"collection":[...]}

You can change the page you’re viewing or the number of results by modifying these parameters. Here is an example:

curl --request GET \
> --url 'https://onepost1.p.rapidapi.com/api/v1/events?per_page=15&page=2&secret_key=sk-cbe...' \
> --header 'x-rapidapi-host: onepost1.p.rapidapi.com' \
> --header 'x-rapidapi-key: 9d0...'

{"current_page":2,"per_page":15,"total_entries":31,"collection":[...]}

Notice the per_page=15&page=2 in the request parameters. (Please note that the maximum per_page value is 100)