Skip to content

Unnecessary api call to /rest/api/2/field #1859

Open
@aneeshco

Description

@aneeshco

Bug summary

When doing api call using search_issues, it makes two API calls, one GET to the endpoint /rest/api/2/field and another to the actual url /rest/api/2/search. The first api call, returns the whole fields present in the JIRA server environment causing performance issues in the server. This is only done once the first time the function is used. Can this function be updated so that only the /rest/api/2/search is accessed?

issues_page = jira.search_issues(
jql_query,
startAt=start_at,
maxResults=MAX_RESULTS,
validate_query=False,
fields=fields_arg,
expand=None,
properties=None,
use_post=True)

Is there an existing issue for this?

  • I have searched the existing issues

Jira Instance type

Jira Server or Data Center (Self-hosted)

Jira instance version

9.4.6

jira-python version

3.8

Python Interpreter version

3.11.5

Which operating systems have you used?

  • Linux
  • macOS
  • Windows

Reproduction steps

# 1. Given a Jira client instance
jira: JIRA
# 2. When I call the function with below arguments 
issues_page = jira.search_issues(
                jql_query, 
                startAt=start_at, 
                maxResults=MAX_RESULTS,
                validate_query=False,
                fields=fields_arg,
                expand=None,
                properties=None,
                use_post=True)
# 3. It first calls the field endpoint and then it calls the search endpoint the first time, subsequent times doesnot include calls to field endpoint
# 4. It should only call the search endpoint and not the field endpoint
...

Stack trace

The order of api calls as below when

/rest/api/2/serverInfo - authentication
/rest/api/2/field -  first call to search_issues function
/rest/api/2/search - first call to search_issues function
/rest/api/2/search - second call to search_issues function
/rest/api/2/search - third call to search_issues function
/rest/api/2/search - fourth call to search_issues function

Expected behaviour

Expected behaviour as below
/rest/api/2/serverInfo - authentication
/rest/api/2/search - first call to search_issues function
/rest/api/2/search - second call to search_issues function
/rest/api/2/search - third call to search_issues function
/rest/api/2/search - fourth call to search_issues function

Additional Context

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions