Using pagination for Okta API

I am attempting to use n8n to query the Okta API and having trouble with pagination via the HTTP Request node.

Okta’s API returns the next page URL in the $ as a string type with both the self and next links embedded; rel=“self”,; rel=“next”

I’m not sure how using a fixed value or javascript expression i can convert this output form the API into the “next” URL since it’s not standalone string or an array i can reference. Seems like perhaps some complex regex to extract the contexts maybe? I just feel there has to be a better way

Hey @Dan_Westness,

Welcome to the community :cake:

Best I can think of without playing with the API would be to use some regex to get the next url.

I ended up with this as a working model. I feel like it might be a little dirty as my regex-fu is novice.



Hey @Dan_Westness,

That looks like what I would do, Maybe we should change it to automatically extract the next if it exists :thinking:

1 Like