SaaS Pagination
These pagination strategies allow fidesops to incrementally retrieve content from SaaS APIs. APIs can vary in the way subsequent pages are accessed so these configurable options aim to cover a majority of common use cases.
Supported strategies
offset
: Iterates through the available pages by incrementing the value of a query param.link
: Uses links returned in the headers or the body to get to the next page.cursor
: Uses a value from the last-retrieved object to use as a query param pointing to the next set of results.
Offset
This strategy can be used to iterate through pages, or to define the offset for a batch of results. In either case, this strategy increments the specified query param by the increment_by
value until no more results are returned or the limit
is reached.
Configuration details
incremental_param
(str): The query param to increment the value for.increment_by
(int): The value to increment theincremental_param
after each set of results.limit
(str): The max value theincremental_param
can reach.
Example
This example would take the page
query param and increment it by 1 until the limit of 10 is reached or no more results are returned (whichever comes first).
1 2 3 4 5 6 |
|
Link
This strategy is used when the link to the next page is provided as part of the API response. The link is read from the headers or the body and used to get the next page of results.
Configuration details
source
(str): The location to get the link from, can be eitherheaders
orbody
.path
(str): The expression used to refer to the location of the link within the headers or the body.
Examples
The source value of headers
is meant to be used with responses following RFC 5988.
1 2 |
|
next
(case-insensitive). This indicates that we are looking in the Link
header with a rel
of next.
1 2 3 4 5 |
|
We can also access links returned in the body. If we receive this value in the body:
1 2 3 4 5 6 7 |
|
next_page.url
as the expression to access the url.
1 2 3 4 5 |
|
Cursor
This strategy is used when a specific value from a response object is used as a cursor to determine the starting point for the next set of results.
Configuration Details
cursor_param
(str): The name of the query param to assign the cursor value to.field
(str): The field to read from the most recently retrieved object to use as the cursor value.
Examples
If an API request returns the following:
1 2 3 4 5 6 7 |
|
id
from the last item returned and generate a new request with a query param of after=3
1 2 3 4 5 |
|