Forum Discussion

leonardoamorim's avatar
leonardoamorim
New Contributor
5 years ago

REST Get Pagination

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:

  • from
  • to
  • type
  • limit (always a 100)

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 =)