Use the Openbrewerydb API to do pagination
Some APIs paginate using a page number and page size, but do not include any information about the next page or total number of pages in their responses — not in the response body, headers, or metadata. This article explains how to configure the Jet Analytics REST data source to handle this type of pagination using a dynamic stop condition.
The Open Brewery DB API (api.openbrewerydb.org/v1/) is used as the example. It uses page and per_page query parameters for pagination, with no next-page or last-page information in the response.
If the API returns the next page URL in a response header, use the header-based pagination approach instead. If the next page URL appears in the response body, use the metadata-based pagination approach instead.
Step 1: Configure the data source base URL
Add the Jet Analytics REST data source and set the Base URL to:
https://api.openbrewerydb.org/v1/
Step 2: Configure pagination
Use the {TX_NextPage} operator to drive page-number pagination. This variable starts at 1 and increments by 1 on each iteration. Because the API does not return any last-page information, a dynamic stop condition is required to detect when the response is empty and stop paginating.
Examining the response on the first page and the last page makes the stop condition clear:
When the last page has been reached, the response contains no data records. The XPath expression (*/*/*)[1] checks whether any content exists at the third level of the response XML — if not, pagination stops. An equivalent form is (TX_Autogenerated_Root/TX_Autogenerated_Element)[1]/*[1].
Add the following in the pagination configuration:
- A Parameter with:
-
Name:
stopCondition - Type: XPath
-
Value:
(*/*/*)[1]
-
Name:
- A Query Parameter with:
-
Name:
page -
Value:
{TX_NextPage}
-
Name:
The parameter name page is case-sensitive. Verify the exact parameter name used by the API — an incorrect case will cause pagination to fail silently.
Step 3: Configure the endpoint
Add the endpoint with:
- Name: Breweries
-
Path:
breweries -
Query Parameter — Name:
per_page, Value:200
The per_page parameter must be added at the endpoint level, not in the pagination section. The reason is that the very first request is made without any pagination parameters applied — adding per_page to the pagination section would mean the first call uses the API's default page size (50 records), while subsequent calls use 200. This mismatch could cause records to be missed on the boundary between the first and second pages.