Hi EM Community,
I am hoping to get some advice if anyone has dealt with a similar situation that I am having regarding repeating call requests to a GraphQL endpoint where a cursor string is returned and needs to be fed back into the loop to call the next set of items.
As a preface, I did read the below article on pagination but am still confused on my scenario.
Here is the documentation for the API I am calling. I don't really have any expectation for anyone to read this but just putting it here anyway.
I am including an image below my use case/problem explanation to show the flow.
Ok... The issue.
The platform of the API I am calling has boards that are essentially act like glorified excel workbooks. I need to query the board I am attempting to poll the records from to get a cursor string to start off a repeat loop of requests until all of the items are returned.
The cursor string from the first graphql query needs to be passed into a second and entirely different query to request the next set of records. I need to repeat this until all the items are returned and exhausted.
If I split into two modules, and have the repeat action in the first to call the second module where the second query resides, I am having trouble figuring out how to pass back the query string that is returned from the module 2 query back into the repeat action in call one to continue the loop until all the records are returned.
Some notes:
-
I have to specific the number of records/items I want returned in the body of my query. If the number of items is greater than the number of items remaining in the board, the cursor string will be empty for every returned record and after these are returned, I need to stop the loop.
-
If the number of items being requested to be returned is less than the count of the remaining items in the board, the same cursor string is returned for every record in the response. I need to take the cursor string value from one of these and pass it back to the module where the repeat is being done to continue the loop.
-
Not sure if relevant, but the length of the cursor string looks like it is always 70 characters.
Hopefully the image I am attaching helps clear up some gaps.
Any ideas anyone has would be sincerely and greatly appreciated!!!