I am trying to change Project Lead by API, but I am getting the error:
{ "errorMessages": [ "Can not deserialize instance of java.lang.String out of START_OBJECT token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@3e2799bc; line: 2, column: 5] (through reference chain: com.atlassian.jira.rest.v2.issue.project.ProjectInputBean[\"lead\"])" ]}
I am doing a PUT to here:
https://server/rest/api/latest/project/PROJKEY
Of this content:
{ "lead": { "key":"jsmith" } }
Any ideas please?
Hi,
Use the following payload instead:
{"lead":"username"}
Here is a working example using cURL:
curl -X PUT http://localhost:8080/rest/api/2/project/PROJECTKEY -d '{"lead":"username"}' -u "admin:secret" -H "Content-Type: application/json" -vvv
Kind Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are welcome :)
Did my answer solves your problem?
If so, consider to mark the proposed solution as an 'Accepted answer'. This will help other people with the same or a quite similar problem to find a solution in a easy and faster way.
In addition, by doing this the post will automatically gain the "Solved:" prefix in search results to indicate other people that no further support is needed.
Kind Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using the REST API, I cloned a project, and the suggested answer with the payload {"lead", "username"} comes back with a success status of 200, but the UI does not show an update. So, I did a fetch after the update and observed the update took place as expected. Why UI does not show it remains a mystery until someone comes up with more details.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello all.
The solution above doesn't work for me, at least using curl from Powershell. Doesn't matter what I do, I got an error (Unexpected character ('l' (code 108)):) this character is l of "lead". It means doesn't matter what I put after "-d", the first character, except the '{, will get this error.
Ok, let's go direct to the point. If you are stuck in PowerShell for this, follow what's worked for me (Powershell)
There is a Jira module for PowerShell, JiraPS, it has good commands to create issues, get information, and other functions you can check. But there are no commands for much other stuff. In this case, there is a special command, Invoke-JiraMethod. This basic process the rest API correctly in Powershell. To change the project lead, in my case is an offboarding scenario, so I want to deactivate the user, but we can't deactive a user that is a leader of a project. Using the same module, JiraPS:
Find projects that the user is leading:
$project_lead = Get-JiraProject | Where-Object {$_.LEAD -match "$user" }
$project_key = $project_lead.key
Then I use foreach to loop into the result to change the lead of all projects this user is leading.
basic the command is
$body = '{"lead": "$newlead_username"}'
$parameter = @{
Uri = "$(Get-JiraConfigServer)/rest/api/latest/project/$project_key" #$project_key is the project achronismus
Method = "PUT"
Body = $body
}
Invoke-JiraMethod @params
Finally, deactivate the user
Set-JiraUser -User $user -Active $False
More information about JiraPS PowerShell module:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.