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

Accepted Answer
0 votes

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
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

23,882 views 2 7
Join discussion

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