03-07-2022 05:56 PM
This article is very similar to my question.
I’m in a bit of a different boat though. My pagination is buried as a string within a string within the headers - not entity.
I am able to parse with something like $headers.link.split(“;”)[1]
but this seems brittle.
My GET snap doesn’t like this for a hasNext: $headers.link.contains(‘rel=“next”’)
Solved! Go to Solution.
03-08-2022 05:13 AM
Okta is also one of my use cases, so I’ve worked this out before. Here is my approach (there are alternatives to the syntax):
For copy/paste…
Has next: $headers.link.contains("\"next\"")
Next URL: $headers.link.replace(/^<(.+)>.+/,"$1")
03-07-2022 11:54 PM
Can you try to replace your hasNext expression to: $headers.hasPath(“link”) && $headers.link.contains(“next”), and try this for your nextUrl expression: $headers.link.split(“;”)[0].replaceAll(‘<’,‘’).replaceAll(‘>’,‘’). This should work if the link header containts only the next link, but if some cases include more than the next link, for example if there are prev and last link there would be another solution. Let me know if this helps.
Best regards,
Aleksandar.
03-08-2022 12:47 AM
I had the similar usecase and I used below expressions for pagination. You can also try the same.
$headers.link.contains(‘rel=“next”’) for hasNext expression and $headers.link.substr($headers.link.indexOf(‘<’)+1,$headers.link.indexOf(‘>’)-1) for nextUrl expression. Let me know if this helps.
Regards,
Kanika
03-08-2022 05:13 AM
Okta is also one of my use cases, so I’ve worked this out before. Here is my approach (there are alternatives to the syntax):
For copy/paste…
Has next: $headers.link.contains("\"next\"")
Next URL: $headers.link.replace(/^<(.+)>.+/,"$1")
03-08-2022 06:39 AM
Thanks all! I knew I was on the right path - but needed some eagle eyes to point me in the right direction.