Jira Search Api (rest/2/search)returns inconsistent issue count (works locally but fails in CI pipeline)

Hi Team,

I am facing an issue with the Jira Search API(rest/2/search) when running my test cases. The API call:

GET https://xyz.com/rest/api/2/search?maxResults=10&startAt=0&jql=project=ABCD

is returning inconsistent results between local and CI pipeline environments.


Problem Details:

  • :white_check_mark: On local environment:

    • The API works perfectly.

    • All test cases (both Server and Cloud) pass successfully.

  • :cross_mark: On CI pipeline:

    • Server-related test cases:white_check_mark: Passing.

    • Cloud-related test cases:cross_mark: Failing due to inconsistent issue counts or unexpected responses.

    • The same API endpoint and JQL work fine locally but fail in the CI pipeline. Please suggest a solution for these issue.

Hello @AyashaSikilkar

It can be one of these:

  • The token/account used by CI may not see all issues (project role, group, or issue security levels), so the search returns fewer results.
  • Jira Cloud’s /rest/api/3 is the canonical, actively maintained API. /rest/api/2 still exists but can behave differentl
  • Asserting on returned issues.length (limited by maxResults) instead of total (the true match count) makes tests flaky.

Hope it may help you.

Hi @AyashaSikilkar,

You may be running into eventual consistency issues if you’re creating/updating issues and then asserting on search results.

The API you’re currently using is deprecated, but the new search API has a reconcileIssues parameter you can use to guarantee consistency for a set of issue keys.

Hope this helps!

Tim

Hi Tim,

These api is only available in cloud i want solution which works in both cloud and server