โ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!