Update component lead from jira-python?

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 vote

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
}

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)

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Monday in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

702 views 6 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you