Skip to content

Migrate Jira integration from deprecated API v2 to v3 endpoints#117

Open
Claude wants to merge 3 commits intomainfrom
claude/update-jira-api-endpoints
Open

Migrate Jira integration from deprecated API v2 to v3 endpoints#117
Claude wants to merge 3 commits intomainfrom
claude/update-jira-api-endpoints

Conversation

@Claude
Copy link

@Claude Claude AI commented Feb 6, 2026

Atlassian removed Jira API v2 endpoints (/rest/api/2/search, /rest/api/2/field, /rest/api/2/serverInfo) effective May 2025. The integration was failing with "The requested API has been removed. Please migrate to the /rest/api/3/search/jql API."

Changes

  • Configure Python jira library to use API v3 by passing options={"api_version": 3} to the JIRA client constructor in jiralib.py

This ensures all API calls automatically use the v3 endpoints:

  • /rest/api/2/search/rest/api/3/search/jql
  • /rest/api/2/field/rest/api/3/field
  • /rest/api/2/serverInfo/rest/api/3/serverInfo
# jiralib.py:53
self.j = JIRA(url, basic_auth=(user, token), options={"api_version": 3})
Original prompt

This section details on the original issue you should resolve

<issue_title>Integration nonfunctional - must use new Jira API endpoints</issue_title>
<issue_description>Integration failed with message:

"text: The requested API has been removed. Please migrate to the /rest/api/3/search/jql API. A full migration guideline is available at https://developer.atlassian.com/changelog/#CHANGE-2046"

Note the endpoints for which requests to Jira failed are:
/rest/api/2/search
/rest/api/2/field
/rest/api/2/serverInfo

The search function is being replaced by:
/rest/api/3/search/jql</issue_description>

<agent_instructions>We need to switch off of deprecated endpoints mentioned in the PR description. </agent_instructions>

Comments on the Issue (you are @claude[agent] in this section)

@zkoppert I'm not aware of anyone actively maintaining this repo. It is likely one that should be archived. @zkoppert Are either of you interested in reviewing an API update to this integration? @AndreiRosu @jacksonblalock

I could take a try at converting it over to the new endpoints but I don't have a test setup. I'd prefer not to leave you all hanging if this is something that is really needed.</comment_new>

Co-authored-by: zkoppert <6935431+zkoppert@users.noreply.github.com>
@Claude Claude AI changed the title [WIP] Update integration to use new Jira API endpoints Migrate Jira integration from deprecated API v2 to v3 endpoints Feb 6, 2026
@Claude Claude AI requested a review from zkoppert February 6, 2026 23:53
Copy link

@jmeridth jmeridth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zkoppert zkoppert marked this pull request as ready for review February 7, 2026 03:24
Copilot AI review requested due to automatic review settings February 7, 2026 03:24
@zkoppert
Copy link
Member

zkoppert commented Feb 7, 2026

Cc/ @jacksonblalock

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Jira client initialization to target Jira REST API v3 endpoints, addressing failures caused by removed v2 endpoints in newer Jira environments.

Changes:

  • Configure the python-jira JIRA client with options={"api_version": 3}.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jiralib.py Outdated
self.user = user
self.token = token
self.j = JIRA(url, basic_auth=(user, token))
self.j = JIRA(url, basic_auth=(user, token), options={"api_version": 3})
Copy link

Copilot AI Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-codes Jira REST API v3 for all deployments. The repo documentation and CLI/action inputs currently describe targeting a “Jira Server instance”; Jira Server/Data Center may not expose the v3 REST API, so this change could break those users. Consider making the REST API version configurable (e.g., input/env var with a default aligned to documented support) or implementing a simple fallback/auto-detect, and update the docs accordingly.

Copilot uses AI. Check for mistakes.
Copy link

@jacksonblalock jacksonblalock Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this line, but it seems that it does not change the outcome. I am getting the same error, but pasting a cleaned trace below.

Syncing salesforce...
/home/[user]/.local/share/virtualenvs/ghas-jira-integration-[hash]/lib/python3.12/site-packages/jira/init.py:4: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
import pkg_resources
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): [company].atlassian.net:443
DEBUG:urllib3.connectionpool:https://[company].atlassian.net:443 "GET /rest/api/2/serverInfo HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://[company].atlassian.net:443 "GET /rest/api/2/field HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:https://[company].atlassian.net:443 "GET /rest/api/2/search?jql=project%3D%22VULN%22+and+description++%22[hash]%22&startAt=0&validateQuery=True HTTP/1.1" 410 None
Traceback (most recent call last):
File "/home/[user]/ghas-jira/tools/ghas-jira-integration/cli.py", line 321, in
main()
File "/home/[user]/ghas-jira/tools/ghas-jira-integration/cli.py", line 318, in main
args.func(args)
File "/home/[user]/ghas-jira/tools/ghas-jira-integration/cli.py", line 99, in sync
state = jira_project.fetch_repo_state(repo_id, args.state_issue)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[user]/ghas-jira/tools/ghas-jira-integration/jiralib.py", line 147, in fetch_repo_state
i = self.get_state_issue(issue_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[user]/ghas-jira/tools/ghas-jira-integration/jiralib.py", line 122, in get_state_issue
self.j.search_issues(issue_search, maxResults=0),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[user]/.local/share/virtualenvs/ghas-jira-integration-[hash]/lib/python3.12/site-packages/jira/client.py", line 2523, in search_issues
issues = self._fetch_pages(
^^^^^^^^^^^^^^^^^^
File "/home/[user]/.local/share/virtualenvs/ghas-jira-integration-[hash]/lib/python3.12/site-packages/jira/client.py", line 636, in _fetch_pages
resource = self._get_json(request_path, params=page_params, base=base)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[user]/.local/share/virtualenvs/ghas-jira-integration-[hash]/lib/python3.12/site-packages/jira/client.py", line 3139, in _get_json
r = self._session.get(url, params=params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[user]/.local/share/virtualenvs/ghas-jira-integration-[hash]/lib/python3.12/site-packages/jira/resilientsession.py", line 172, in get
return self.__verb("GET", url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/[user]/.local/share/virtualenvs/ghas-jira-integration-[hash]/lib/python3.12/site-packages/jira/resilientsession.py", line 168, in __verb
raise_on_error(response, verb=verb, **kwargs)
File "/home/[user]/.local/share/virtualenvs/ghas-jira-integration-[hash]/lib/python3.12/site-packages/jira/resilientsession.py", line 53, in raise_on_error
raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 410 url: https://[company].atlassian.net/rest/api/2/search?jql=project%3D%22VULN%22+and+description+
+%22[hash]%22&startAt=0&validateQuery=True
text: The requested API has been removed. Please migrate to the /rest/api/3/search/jql API. A full migration guideline is available at https://developer.atlassian.com/changelog/#CHANGE-2046

response headers = {'Content-Type': 'application/json;charset=UTF-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Date': 'Fri, 13 Feb 2026 16:25:47 GMT', 'Server': 'AtlassianEdge', 'Timing-Allow-Origin': '*', 'X-Arequestid': '[request-id]', 'X-Seraph-Loginreason': 'AUTHENTICATED_FAILED', 'Cache-Control': 'no-cache, no-store, no-transform', 'X-Content-Type-Options': 'nosniff', 'X-Xss-Protection': '1; mode=block', 'Atl-Traceid': '[trace-id]', 'Atl-Request-Id': '[request-id]', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'Report-To': '{"endpoints": [{"url": "https://[cdn-url]"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}', 'Nel': '{"failure_fraction": 0.01, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}', 'Server-Timing': 'atl-edge;dur=71,atl-edge-internal;dur=17,atl-edge-upstream;dur=54,atl-edge-pop;desc="aws-us-east-1"', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 [cloudfront-id].cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'DEN53-P3', 'X-Amz-Cf-Id': '[cloudfront-request-id]'}
response text = {"errorMessages":["The requested API has been removed. Please migrate to the /rest/api/3/search/jql API. A full migration guideline is available at https://developer.atlassian.com/changelog/#CHANGE-2046"],"errors":{}}

Key Issue: The Jira API v2 endpoint has been deprecated. You need to update your code to use /rest/api/3/search/jql instead of /rest/api/2/search.

…onfigurability

- Fix option key: 'api_version' -> 'rest_api_version' (the wrong key was
  silently ignored, causing requests to still hit /rest/api/2/ endpoints)
- Upgrade jira library from ~=3.0.0 to ~=3.10.0 (adds support for the
  new /rest/api/3/search/jql endpoint via enhanced_search_issues)
- Replace search_issues() with enhanced_search_issues() at both call
  sites to use the new search endpoint
- Make API version configurable via --jira-api-version CLI arg,
  jira_api_version action input, and GH2JIRA_JIRA_API_VERSION env var
  (defaults to '3' for Jira Cloud, use '2' for Jira Server/Data Center)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@zkoppert
Copy link
Member

@jacksonblalock Thanks for testing and reporting back with the detailed trace — that was very helpful in diagnosing the issue. The original fix had three problems:

  1. Wrong option key: options={"api_version": 3} uses the wrong key. The python-jira library expects rest_api_version, not api_version. The wrong key was silently ignored, which is why your debug logs still showed requests going to /rest/api/2/ endpoints.

  2. Library too old: The jira library was pinned at ~=3.0.0. Even with the correct option key, Atlassian removed both /rest/api/2/search and /rest/api/3/search — the new endpoint is /rest/api/3/search/jql. The python-jira library only added support for this (via enhanced_search_issues()) in v3.10.x.

  3. Wrong search method: The search_issues() method uses the old /search path. The new enhanced_search_issues() method targets the /search/jql endpoint.

I just pushed a commit that fixes all three issues:

  • Fixed option: options={"rest_api_version": api_version}
  • Upgraded jira library from ~=3.0.0 to ~=3.10.0
  • Replaced search_issues() with enhanced_search_issues() at both call sites
  • Made the API version configurable via --jira-api-version CLI arg / jira_api_version action input (defaults to "3" for Jira Cloud; use "2" for Jira Server/Data Center)

Could you test again with these changes and let us know if it resolves the 410 errors? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integration nonfunctional - must use new Jira API endpoints

5 participants