diff --git a/jira/client.py b/jira/client.py index 71665a15..7c24ff71 100755 --- a/jira/client.py +++ b/jira/client.py @@ -1737,6 +1737,25 @@ def search_issues(self, jql_str, startAt=0, maxResults=50, validate_query=True, return issues + def search_for_issues_by_key(self, search_key): + ''' + Get a List of issue matching on search string. + Use issuePicker rest API to fetch Issues. + + :param search_key: input from user for the issue to be found + :return: JSON response will be returned if issues found; otherwise returns, msg:No match found. + + In constatn JIRA_API_ISSUE_SEARCH, showSubTasks=true and showSubTaskParent=true will get sub & parent + tasks of searched result currentJQL=' (leaving it blank) will search in the whole corpus, not just + Recently-viewed issues. which is the default. Doc is at + https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-getIssuePickerResource + ''' + JIRA_API_ISSUE_SEARCH = "/rest/api/2/issue/picker" \ + "?showSubTasks=true&showSubTaskParent=true¤tJQL=&query=" + search_url = "{}{}{}".format(self._options["server"], JIRA_API_ISSUE_SEARCH, search_key) + search_result = self._session.get(search_url) + return search_result.json() + # Security levels def security_level(self, id): """