11-04-2020 11:30 AM
Hello,
I’m calling a REST API which requires me to increment a ‘page’ value in order to get all the results. The issue is the API doesn’t return any metadata. For example:
1st call is: https:domain.com/object/page/1
Results:
{
entity:[
{…},{…},…
]
}
Has next: typeof $entity == ‘array’ && $entity.length > 0
Next URL: https:domain.com/object/page/2
The problem is how to I compute the 2 (then 3,4,5… etc) Is it possible to increment a value by 1 on every subsequent call? Or is it possible to access a variable that counts how many times the call has been made?
Thanks!
11-04-2020 12:13 PM
For Next URL I believe you can use the expression:
'https:domain.com/object/page/' + (snap.out.totalCount + 1).toString()
to have second request add 2, then 3, 4, 5, and so on.
11-06-2020 07:50 AM
Thanks @cjhoward18, that worked for me!
02-21-2021 05:31 PM
@dmiller : cjhoward18’s response above, i.e.
For Next URL I believe you can use the expression:
'https:domain.com/object/page/' + (snap.out.totalCount + 1).toString()
to have second request add 2, then 3, 4, 5, and so on.
should be added to the pagination portion of the REST Get documentation. I’m working with an API that also does not include the current page number, nor next offset in the response, so implementing pagination requires incrementing the offset. I had to spend 15 minutes searching community before I came across this tip.
02-21-2021 05:33 PM
I’ll let the doc team know.