Skip to content

API Endpoint Deprecated - Migration to /rest/api/3/search/jql Required #2369

Description

@charlesoliveira-trab

Bug summary

Bug Description

The library is using a deprecated JIRA API endpoint that has been removed by Atlassian. Users are receiving error messages indicating they need to migrate to the newer API version.

Error Message

{
  "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": {}
}

Expected Behavior

The library should work with current JIRA API endpoints without throwing deprecation errors.

Actual Behavior

API calls fail with deprecation error messages, preventing normal functionality.

Environment

  • Library Version: 3.10.5
  • JIRA Version: #CHANGE-2046
  • Platform: Python 3.10.12

Additional Context

According to Atlassian's changelog (referenced in the error), there's a migration guide available at the provided URL. The library needs to be updated to use the newer /rest/api/3/search/jql endpoint instead of the deprecated one.

Suggested Solution

Update the library to use the current JIRA REST API v3 endpoints as specified in Atlassian's migration guidelines.

Migration Reference

Priority

High - This affects all users of the library when working with updated JIRA instances.

Is there an existing issue for this?

  • I have searched the existing issues

Jira Instance type

Jira Cloud (Hosted by Atlassian)

Jira instance version

No response

jira-python version

main

Python Interpreter version

3.10.5

Which operating systems have you used?

  • Linux
  • macOS
  • Windows

Reproduction steps

def get_jira_client(
    server=st.JIRA_URL, user=st.JIRA_USERNAME, token=st.JIRA_API_TOKEN
):
    logger.info('Conectando ao Jira...')
    options = {'server': server}
    jira = JIRA(options, basic_auth=(user, token))
    return jira


JIRA_CLIENT = get_jira_client()


def fetch_tickets(
    jira_client=JIRA_CLIENT, jql_query='', max_results=50, filter=True
):
    # logger.info('Buscando Tickets...')
    start_at = 0
    all_tickets = []
    fields = None
    if filter:
        fields = (
            (
                'key'
                + ',project'
                + ',summary'
                + ',description'
                + ',status'
                + ',priority'
                + ',reporter'
                + ',assignee'
                + ',labels'
                + ',created'
                + ',updated'
                + ',duedate'
                + ',resolutiondate'
                + ',resolution'
                + ',progress'
                + ',votes'
                + ',issuetype'
                + ',parent'
                + ',watches'
                + ',security'
                + ',timetracking'
                + ',customfield_10182'
                + ',customfield_10020'
                + ',customfield_10026'
                + ',customfield_10016'
                + ',customfield_10902'
                + ',customfield_10903'
            ),
        )
    # logger.info( '\tJQL: ', jql_query)
    # logger.info( '\tFields: ', fields)
    while True:
        issues = jira_client.search_issues(
            jql_query,
            startAt=start_at,
            maxResults=max_results,
            fields=fields,
        )
        if not issues:
            break
        all_tickets.extend(issues)
        start_at += max_results
        if len(issues) < max_results:
            break
    return all_tickets

Stack trace

Traceback (most recent call last):
  File "/jira-integration/src/main.py", line 27, in <module>
    main()
  File "/jira-integration/src/main.py", line 14, in main
    jr.tickets_update(periodo=st.JIRA_PERIOD)
  File "/jira-integration/src/services/jira_client.py", line 126, in tickets_update
    get_tickets(
  File "/jira-integration/src/services/jira_client.py", line 111, in get_tickets
    issues = fetch_tickets(jira_client=JIRA_CLIENT, jql_query=jql_query)
  File "/jira-integration/src/services/jira_client.py", line 67, in fetch_tickets
    issues = jira_client.search_issues(
  File "/jira-integration/.venv/lib/python3.10/site-packages/jira/client.py", line 3634, in search_issues
    raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP None
        text: The `search` API is deprecated in Jira Cloud. Use `enhanced_search_issues` method instead.

Expected behaviour

The library should work with current JIRA API endpoints without throwing deprecation errors.

Additional Context

According to Atlassian's changelog (referenced in the error), there's a migration guide available at the provided URL. The library needs to be updated to use the newer /rest/api/3/search/jql endpoint instead of the deprecated one.

Environment

  • Library Version: 3.10.5
  • JIRA Version: #CHANGE-2046
  • Platform: Python 3.10.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions