Pagination
Overview
When making REST API calls to a specific endpoint using the GET method of the HTTP Client Snap, there might be a lot of results to return. In order to divide the results into multiple pages for easier handling, use the pagination settings. For example, you make a REST API call to return all the pages from a Salesforce instance; the response can be thousands of pages, which is undesirable. You can use the Pagination settings to configure the Has Next field and set the number of pages to fetch to get a specific number of results.
Pagination for POST requests
The HTTP Client Snap does not automatically resend data in subsequent pagination requests. Therefore, we suggest the following solution to efficiently navigate through results from an API that requires the data to be resent with each request.
Problem: Endpoint API requires filter/sort criteria to be re-posted with each call.
Solution:
Configure the HTTP Client Snap to make an initial API call (without pagination settings) to fetch the first result set.
Configure the Router snap to perform the following tasks:
Pass through the first result set obtained from the HTTP Client.
Determine if pagination is required based on specific criteria.
Configure the Mapper snap to create an array of page numbers to retrieve.
Utilize the JSON Splitter Snap to convert the page number array into individual documents.
Configure the HTTP Client Snap to make subsequent API calls for the remaining result set. Ensure to exclude pagination settings for each call.
Connect the Union Snap to merge the retrieved results from all the API calls for further processing.
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.