Update component lead from jira-python?

Chris Kast December 11, 2014

Is there a way to update the component lead for a component using jira-python? When you create a component there's the 'leadUserName' param but I want to update an existing component. Thanks!

2 answers

1 accepted

0 votes
Answer accepted
Matheus Fernandes
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 12, 2014

Hi Chris,

You can use rest using the call /rest/api/2/component/{id} - Using PUT you can update the fields of the component. As per https://docs.atlassian.com/jira/REST/latest/#d2e3939:

Modify a component via PUT. Any fields present in the PUT will override existing values. As a convenience, if a field is not present, it is silently ignored. If leadUserName is an empty string ("") the component lead will be removed.

For example:

{
    "name": "Component 1",
    "description": "This is a JIRA component",
    "leadUserName": "fred",
    "assigneeType": "PROJECT_LEAD",
    "isAssigneeTypeValid": false
}
Chris Kast December 12, 2014

Thanks, Matheus. Yeah, this is how I ended up implementing it but I was hoping it was possible to do this using the native python client (https://bitbucket.org/bspeakmon/jira-python)

1 vote
R.S. February 9, 2017

With jira-python, you need to get a component object first:

component = jira_connection.component(id)

And then you just need to update the specific field:

component.update( fields={ "leadUserName": username } )

Suggest an answer

Log in or Sign up to answer