API responds with Cannot get programs. The node count limit of '100' has been exceeded. To increase
Asked by Janu Shah:

While executing the below request:

[https://opshub.jiraalign.com/rest/align/api/2/Programs?$filter=portfolioId+eq+4+or+portfolioId+eq+8+or+portfolioId+eq+9+or+portfolioId+eq+10+or+portfolioId+eq+11+or+portfolioId+eq+12+or+portfolioId+eq+13+or+portfolioId+eq+14+or+portfolioId+eq+15+or+portfolioId+eq+16+or+portfolioId+eq+17+or+portfolioId+eq+18+or+portfolioId+eq+19+or+portfolioId+eq+20+or+portfolioId+eq+24+or+portfolioId+eq+26+or+portfolioId+eq+27+or+portfolioId+eq+29+or+portfolioId+eq+30+or+portfolioId+eq+31+or+portfolioId+eq+32+or...](https://opshub.jiraalign.com/rest/align/api/2/Programs?$filter=portfolioId+eq+4+or+portfolioId+eq+8+or+portfolioId+eq+9+or+portfolioId+eq+10+or+portfolioId+eq+11+or+portfolioId+eq+12+or+portfolioId+eq+13+or+portfolioId+eq+14+or+portfolioId+eq+15+or+portfolioId+eq+16+or+portfolioId+eq+17+or+portfolioId+eq+18+or+portfolioId+eq+19+or+portfolioId+eq+20+or+portfolioId+eq+24+or+portfolioId+eq+26+or+portfolioId+eq+27+or+portfolioId+eq+29+or+portfolioId+eq+30+or+portfolioId+eq+31+or+portfolioId+eq+32+or+portfolioId+eq+33+or+portfolioId+eq+34+or+portfolioId+eq+35+or+portfolioId+eq+36+or+portfolioId+eq+37+or+portfolioId+eq+38+or+portfolioId+eq+39+or+portfolioId+eq+40+or+portfolioId+eq+41+or+portfolioId+eq+42+or+portfolioId+eq+43+or+portfolioId+eq+44+or+portfolioId+eq+45+or+portfolioId+eq+46+or+portfolioId+eq+47+or+portfolioId+eq+48+or+portfolioId+eq+49+or+portfolioId+eq+50+or+portfolioId+eq+51+or+portfolioId+eq+52+or+portfolioId+eq+53&$select=id,title,portfolioId)

I am facing the following API response with status code 400 bad request.

Error message: Cannot get programs. The node count limit of '100' has been exceeded. To increase the limit, set the 'MaxNodeCount' property on EnableQueryAttribute or ODataValidationSettings.

What is the cause for this api error?


Answers:
author: Heidi Hendry
body: Hi Janu,

Are you looping your request?  

[API 2.0 GET usage and filters -- Jira Align](https://help.jiraalign.com/hc/en-us/articles/360048085774-API-2-0-GET-usage-and-filters)

*In addition, because of the number of records that can be returned in a GET API call, 100 items is the maximum that can be returned in a single call. Thus when using the API, you must loop through batches of 100 to get all items.*


author: James Webber
body: I am not sure about Align but in Jira I thought the default limit was 100 [Max 100 records when we do API calls against the C... (atlassian.com)](https://community.atlassian.com/t5/Jira-Software-questions/Max-100-records-when-we-do-API-calls-against-the-Cloud-jira/qaq-p/1423126)

I gave up trying to use API to get data from Align and moved back to export to xlsx/csv manually.


author: Allan Maxwell
body: I'm guessing you have hit the limit on how many "OR"s you can have. Can you alter the filter to something smaller such as: {{base_JA_url}}/Programs?$filter=portfolioId EQ 1

comments: author: Allan Maxwell
body: The **ODataValidationSettings.MaxNodeCount**is a setting on the backend web service and thus you will not be able to change it. Your best option is to reconstruct your $filter clause such that there a 99 or fewer "OR"s.