How Update a Component Lead with the Rest API
Purpose
The purpose of this article is to show how to update a component lead using the REST API with Postman.
Finding the Component ID
First we'll need to pull a list of the components from the rest api to get the proper ID. To do this we'll run a GET against the /rest/api/2/project/{projectIdOrKey}/components endpoint. For example my project is called WITI so this will give us the following endpoint:
/rest/api/2/project/WITI/components
Adding in my base url for my testing instance we end up with the following full url:
http://ddiblasio.office.atlassian.com:59491/7.2.2/rest/api/2/project/WITI/components
From the output we'll see all the components. We'll focus in on id 10101, which looks like the following from the output:
"self": "http://ddiblasio.office.atlassian.com:59491/7.2.2/rest/api/2/component/10101",
"id": "10101",
"name": "Test3",
"description": "This is a JIRA component",
"lead": {
"self": "http://ddiblasio.office.atlassian.com:59491/7.2.2/rest/api/2/user?username=MiXeDcAsE",
"key": "admin",
"name": "admin",
Here's a screenshot of what this looks like in PostMan:
Update the Component Lead
Now that the component id is known we can build our request to the Update Component endpoint. From above we can see the id for this component is 10101. We'll append that value to the end of the component endpoint like the following:
/rest/api/2/component/10101
I'd like to update the component lead from admin to MiXeDcAsE, which maps to the leadUserName attribute. The Update Component endpoint will allow us to update this information via the api. Since we only want to change the component lead we can leave out the other fields. This just leaves us with the following json:
{
"leadUserName": "MiXeDcAsE"
}
Here's an example screenshot of what this full request looks like in PostMan (note body is selected, and the raw type of json is selected):
Once we hit Send this will update the component lead.