pythonjirajira-rest-apijira-rest-java-apipython-jira

How to update labels for the issues present in Jql query/Filter


My requirement is: I want to update the labels for the issues present in the filter.

import jira.client
    from jira.client import jira

    options = {'server': 'https://URL.com"}
    jira = JIRA(options, basic_auth=('username], 'password'))
    issue = jira.search_issues('jqlquery')
    issue.update(labels=['Test']

I'm getting attribute error which states that 'Resultlist' object has no attibute 'update'.


Solution

  • Update only works on a single issue. Search_issues returns a ResultList.

    The JIRA API does not support bulk change. However, you can loop over the issues yourself and do the update for each one. Something like:

    import jira.client
    from jira.client import jira
    
    options = {'server': 'https://URL.com'}
    jira = JIRA(options, basic_auth=('username', 'password'))
    
    issues = jira.search_issues('jqlquery')
    for issue in issues:
        issue.update(labels=['Test'])