Using pagination in the API

When a response from the API yields many results, Gemfury will paginate by returning a subset of the results along with metadata linking to the subsequent or previous subsets. Paginating reduces the payload, and thus the processing load on both the servers and clients.

Pagination metadata is encoded in the response using the link header as described in RFC 8288. The presence of this header indicates that the returned results are a subset of all results and that additional pages are available.

The link header may provide the URLs for the previous & next pages of results:

  • The link for the previous page is indicated by rel="prev".
  • The link for the next page is indicated by rel="next".

Note that the link target may not be the full URL, so you must support URI merging and relative resolution as described in Section 5 of RFC 3986.

You should not save any values from the link header because they may include temporary pagination cursors or other expiring values.

Results per page

Gemfury API endpoints that paginate have a default page size; however, you can specify a different page size using the limit URL parameter:

GET https://api.fury.io/1/packages?limit=30

The API may return fewer results than requested via the limit parameter; therefore, your logic should not assume a fixed number of returned results.


Next