I’m currently facing challenges in applying pagination within my workflow. I aim to implement pagination to fetch data from a source efficiently while preventing infinite loops and handling empty responses appropriately.
Steps taken:
Set up a variable to store pagination information.
Configured an HTTP module to fetch data from the source.
Applied the pagination variable in the query parameter of the HTTP module to retrieve specific pages of data.
Implemented safeguards to prevent infinite loops by setting conditions to stop the pagination process.
Created filters to handle empty responses gracefully.
Utilized an HTTP module with filtering capabilities to check for empty data.
Despite the setup and configurations implemented, I’m encountering difficulties in effectively applying pagination within the workflow. The workflow may be entering infinite loops or not handling empty responses as intended. Any insights or suggestions to resolve these issues would be appreciated.
Is it an incremental number of pages or links to next page or something different?
We usually handle pagination using datastores to keep track of the page we reached outside of the scenario it self, maybe you can look into creating something similar?
Basically the scenario overwrites the next entry value in the data store and then it keeps running until it reaches the last page.
Hi @samliew
Scene is , I have configured the pagination using below link
And by following the steps, when I run for the pagination, it’s working, but when for the first time scenario is running, it’s taking wrong pagination steps ( as shown below afterId )
And for error handling I have setup a filter to lookup data.message ( it comes when there is no data from api itself, either it comes with 4XX or 5XX status code ) exist or not.
So problem is causing when first time page value is being set which is not correct and applying with filter on error handler , scenario terminates in the first loop.
Hi @Stoyan_Vatov
It’s issue with the incremental number of pages, not the links to the next page or something.
We need to set the initial value for the page to 1 and it should be increment by 1 like 2,3,4,5,6,7,8,9…,upto last page when data is getting empty from the api response and when we get empty response from the api, it should break the scenario loop and and end that.
But while applying the filter for the error handler loop, it’s ending in the first loop itself, because for the first time page is undefined and from api response it’s returning with status code 4XX .
Hey @Afzal my apologies for the late response, but here it is. I had a look at the blueprint you DMed me and fixed it for you. The root problem you had in it was this (HTTP > Make a request):
You might have had a problem around Repeater as well but not too sure as I had started fixing already and did not get to see it. Anyway, it’s all fixed, simplified, and made versatile.