Parse JSON For Paging (nextLink) Link

  • 25 October 2022
  • 8 replies
  • 663 views

Badge +6

I am using an HTTP API call to get all users in our organization. There are ~1200 active users, so there are multiple pages returned. I can't figure out how to parse JSON to get the nextLink for each page. I'm not using the Nintex 'AAD Query Users' action because it doesn't return the user guid, but even if it did, it also goes to a new page at 999.

 

Everything I've found via Google says that JSONPath query:

$["@odata.nextLink"]

should result in the link, but this fails everywhere I've tried it, including several different JSONPath query testers. I've tried it with single quotes, with brackets, without brackets, with and without the dollar sign, without the '@'... ad nauseum.

 

When I load the data into Power Automate to get the schema, it comes in as

"@@odata.nextLink"
This also doesn't work.

 

Has anyone built a workflow that successfully loops thru pages of results that could show me how you pull the nextlink URL?

 

Better yet. is there a pagination option somewhere that I'm missing?(Nintex, why not?)


8 replies

Userlevel 4
Badge +10

I'm not sure what your JSON formatted data looks like, but I found some other example that included an "odata.nextLink".  The path I'm using in the example below is $.["odata.nextLink"]



 

Badge +6

@bsikes , it *should* work for my data same as it does for yours, but I can't get any of the three odata pairs, no matter what I try.



 


 

Badge +6

I also used this to get the path:



But using this, I get:



So. Wit's end.

Userlevel 4
Badge +10

That is a tricky one.   Another option would be to use the Modify String or Apply a Regular Expression action to replace the '@odata.nextLink' with 'odatanextLink'. Then use the query json to get the value you need. 

Userlevel 3
Badge +8

Hi @AnneC@bsikes,


 


I quickly checked through https://developer.nintex.com


 


It works with $['@odata.nextLink']



 


 Hope that helps. ^^

Badge +6

@cecilia-penha , nope, still no go.


 


1. Start of real data



2. Bottom of data, query, response



 


Everything about it is correct, except it just will not work. I guess I just need to add a regex replace loop around my runif ifexist nextLink loops. Clunky, but it should work (why does that sound familiar?!)

Userlevel 3
Badge +8

Hey @AnneC,


 


It works using the same graph JSON response format:




I am curious to know what makes the difference here.


 


^^

Userlevel 4
Badge +10

@Anne 


 


Maybe I'm missing something obvious, but in your screenshot of the real data, I don't see @odata.nextLink. I see odata.nextLink, without the @ sign. 


 


Also, sometimes Nintex does some really annoying formatting on JSON data (Escaping " with , and putting " before { and }). If that's the case here, the Query JSON action may not work until you strip those extra characters out.  I have a reply on the post below describing how I accomplish that.


https://community.nintex.com/t5/Nintex-Workflow-Cloud-Forum/Extract-single-value-from-on-prem-sql-query-result-object/m-p/227437#M3151


 

Reply