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