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 votes
Accepted answer

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
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

807 views 3 9
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