Pagination

🚧

Enforced max size per page

On some GET resources there is a max records per page enforced regardless if you specify that you want pagination. If you don't send the page parameter you could miss out on records. Check the X-Per-Page header to see allowed records per page.

📘

If there is a Link header, it means that the response contains several pages and that you could step trough pages with the page parameter.

For resources that supports pagination the following headers will be present in the response from the server:

KEY

EXAMPLE VALUE

DESCRIPTION

Link

< https://api.hips.com/v2/merchants?page=1 >; rel="first",
< https://api.hips.com/v2/merchants?page=173 >; rel="last",
< https://api.hips.com/v2/merchants?page=6 >; rel="next",
< https://api.hips.com/v2/merchants?page=4 >; rel="prev"

web linking according to RFC 5988

X-Total

4321

Total number of pages

X-Per-Page

10

Number of records per page

X-Page

5

Current page number

The following parameters are available to set for pagination:

PARAMETER

EXAMPLE VALUE

DESCRIPTION

per_page

5

Requesting 5 records per page

page

10

Requesting to show page 10. First record of this page will be record 50 if per_page is set to 5

$ curl --include 'https://api.hips.com/v2/merchants?per_page=10&page=5'
HTTP/1.1 200 OK
Link: <https://api.hips.com/v2/merchants?page=1>; rel="first",
  <https://api.hips.com/v2/merchants?page=173>; rel="last",
  <https://api.hips.com/v2/merchants?page=6>; rel="next",
  <https://api.hips.com/v2/merchants?page=4>; rel="prev"
X-Total: 4321
X-Per-Page: 10
X-Page: 5
# ...