04-26-2021 07:35 AM
Hi everybody,
I’ve been thinking about a solution to my problem the past few weeks and still couldn’t find a proper solution.
The problem is: I have an REST Output which gives me the following.
The total of outputs I have for ONE day and the data with a limit of 100.
It doesn’t have the offset or number of pages in the output.
I want to fetch all the data for a day (in this case, 10811) so I created a MAPPER with the following values before asking for the REST GET with PAGINATION
Then, I do a REST GET with the following values for:
The problem is when I try to do the pagination that does not work.
For the HasNext field: $entity.data.length > 1 (this is always true until it reaches the last offset value and it returns me an array with 0 data)
For the NextUrl fiel i have : “URL” + + “?from=” + $from + “&to=”+ $to + “&type=”+ $type + “&limit=”+ $limit + “&offset=” + (snap.out.totalCount+100).toString()
I need to increment the OFFSET in the REST GET by 100 every iteration, with a LIMIT of 100 outputs every time, until I have all the TOTAL outputs (in this case, 10811).
I don’t know what I am doing wrong, but i’m getting an error:
“error”:“not found: unable to find valid operation for: null”,“code”:“S21”}"
Can someone help me? Thanks 😃
04-26-2021 08:03 AM
I just did this recently and here was the solution I came up with. Assuming that the response provides the total number of records as “totalItems” in the response $entity object:
It appears you should be able to do something similar. Keep in mind that the Has Next and Next URL properties work from what you see in the output of the REST Get, so you will likely need to prefix your values with $original.
04-27-2021 06:58 AM
Kory, thank you so much for your help! I didn’t quite get it the $original. part, but it worked for me! many thanks!
09-04-2023 12:29 AM
@koryknick Hi Kory , Can you please help me to calculate has next and next url in rest get snap
sample API response
{
"statusLine": {
"protoVersion": "HTTP/1.1",
"statusCode": 200,
"reasonPhrase": "OK"
},
"entity": {
"pageInfo": {
"totalCount": 918,
"startCount": 1,
"limit": 100
},
"usersDetailWithSubLocation": []
09-08-2023 04:49 AM - edited 09-08-2023 04:49 AM
@rahulkalyanwat - I would need more to go on to help ensure I have it right, but Has Next will be something similar to the following:
Has Next: ($entity.startCount + $entity.limit) < $entity.totalCount
I can't help with the Next URL without more information on the API such as any other query parameters you are using and what the pagination parameters are (skip/offset/page, limit/take, etc.)
PS - sorry it took a while for me to respond... I was on vacation. I recommend that you open a new thread rather than replying to a post with secondary questions. This can help ensure more community members see your question and will be likely to respond.
Hope this helps!