Solved

Issue with Retrieving Instances via Nintex Workflow Cloud API

  • 9 October 2023
  • 3 replies
  • 94 views

Badge +1

Dear Nintex Support Team,

I am using PowerShell to interact with the Nintex Workflow Cloud API, and I am encountering an issue when retrieving instances. My goal is to retrieve more than 100 instances from the API, but currently, I am only getting 100 instances, even though the site contains more.

Here is the PowerShell code that I am using to make the request:

# Set the Nintex API URL

$url = "https://eu.nintex.io/workflows/v2/instances?pageSize=100"

# Set the request headers

$headers = @{ 'Authorization' = "Bearer $token" 'Accept' = 'application/json' }

# Make the GET request using Invoke-RestMethod

$response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get

I have noticed that the API limits the number of instances returned in a single request to 100. However, I cannot find information in the documentation on how to retrieve all available instances.

Could you please provide guidance on how to retrieve more than 100 instances from the Nintex Workflow Cloud API using PowerShell? Are there specific parameters or methods I should use to achieve this goal? Or Access additional pages of results if there are multiple pages?

Any assistance you can provide in resolving this issue would be greatly appreciated.

Thank you in advance for your help.

Best regards,

Hassan

icon

Best answer by HassanB 10 October 2023, 01:10

View original

3 replies

Userlevel 2
Badge +6

Hello @HassanB ,

I believe from looking at the documentation, the maximum page size allowed with any api call is 100.
https://developer.nintex.com/docs/nc-api-docs/d7adf56de0029-list-instances

 

Perhaps, you can do a workaround but making several calls by separating the calls using the end and to date parameters. You can then append these to form one data set.

ie. endDateTimeFrom

 

string<date-time>

Filter the list to instances that stopped running after this time.Show all...

Examples:

2022-01-01T01:00:00.0000000Z

endDateTimeTo

string<date-time>

Filter the list to instances that stopped running before this time.Show all...

Examples:

2022-01-01T01:00:00.0000000Z

Badge +1

I would like to thank you for your previous response. I have resolved the issue by using the $nextLink and $skipToken, which now allows me to retrieve more items while applying date filters as needed. Your assistance has been invaluable, and I am grateful for your help.

Once again, thank you for your support.

 

All the best 

Hassan

Userlevel 2
Badge +6

Hello @HassanB ,

I must have overlooked that property. 
I am glad you have a better solution.

Reply