07/24/2023 09:17 PM
I am busing okta REST connection to pull all application as entitlement
it used to use following pagination to get all info
"pagination": {
"nextUrl": {
"nextUrlPath": "${(headers.Link?.contains(','))? headers.Link?.split(',')[1].replace('<', '').replace('>; rel=\"next\"','').trim() : ''}"
}
when checked today, it seems api is changed compared to what I looked last year
It used to be one :"link" in header with comma seperator but now it is showing two seperate "link"
can anyone share what would be pagination for this?
07/25/2023 08:31 AM
You can refer to below format and construct accordingly
"pagination": {
"nextUrl": {
"nextUrlPath": "${(headers?.link?.split(',').size()==2 && headers?.link.contains('next'))?headers.link.split(',')[1].replace('<', '').replace('>; rel=\"next\"','').trim():null}"
}
}
In above example, we are calling the link attribute under headers.
The split is used to tell that the different url links are separated by a comma (,)
size()==2 is used to tell how many links are received in the response header. In our case its 2
headers?.link.contains('next') – is defined to look for the url that includes next keyword. Next represents that this is the url to be called after the current one.
(users?after=00u1ecb28rdo2RpeH0h8&limit=3>; rel="next)
headers.link.split(',')[1] – to split the first url from second and use 2nd one
replace('<', '').replace('>; rel=\"next\"','').trim() – the is just replace function to ensure we can fetch the clean url valu to be used in subsequent call.
07/26/2023 04:35 AM - edited 07/26/2023 04:35 AM