Issue Summary
The v2 or the v3 version of the REST API project endpoint (/rest/api/2/project or /rest/api/3/project) are returning an erorr when using the leadAccountId field to set the project lead.
According to below pages the leadAccountId field should actually be preferred and it has actually been introduced to replace the deprecated lead field.
- Important notice: Upcoming changes to Jira Cloud REST APIs to improve user privacy
- REST API migration guide and deprecation notice - removal of username and userkey
While, at this current point in time, I can see that the lead field actually still works and it still accepts the username as a parameter.
Steps to Reproduce
- Send a POST request to the v2 or v3 REST API endpoint to create a project using the field leadAccountId followed by the account-id of the user you wanna set as the project lead. E.g.:
~$ curl -D- -u EMAIL_ADDRESS:API_TOKEN -H "Accept: application/json" -H "Content-Type: application/json" -d '{"projectTemplateKey":"com.atlassian.jira-core-project-templates:jira-core-simplified-project-management","leadAccountId ":"557057:883xxxx-xxxxxxxxxxxxxx","notificationScheme":10000,"name":"Test Create Project REST","permissionScheme":10025,"assigneeType":"UNASSIGNED","projectTypeKey":"software","key":"TCPR"}' -X POST https://xxxxxxxxxx.atlassian.net/rest/api/2/project
Expected Results
A project is created and you get the project key and id in the response body.
Actual Results
You get error 400 followed by a message saying that the leadAccountId field is not recognized:
{"errorMessages":["Unrecognized field \"leadAccountId \" (Class com.atlassian.jira.rest.v2.issue.project.ProjectInputBean), not marked as ignorable\n at [Source: org.apache.catalina.connector.CoyoteInputStream@22b11c7; line: 1, column: 125] (through reference chain: com.atlassian.jira.rest.v2.issue.project.ProjectInputBean[\"leadAccountId \"])"]}
At the same time, sending the same request using the lead field followed by the username works fine while this should have been deprecated:
curl -D- -u EMAIL:API-TOKEN -H "Accept: application/json" -H "Content-Type: application/json" -d '{"projectTemplateKey":"com.atlassian.jira-core-project-templates:jira-core-simplified-project-management","notificationScheme":10000,"name":"Test Create Project REST","permissionScheme":0,"assigneeType":"UNASSIGNED","projectTypeKey":"business","key":"TCPR","lead":"USERNAME-HERE"}' -X POST https://XXXXXXX.atlassian.net/rest/api/2/project {"self":"https://XXXXXX.atlassian.net/rest/api/2/project/10304","id":10304,"key":"TCPR"}
The exact same behavior is experienced using the /rest/api/3/project/ endpoint
Workaround
Keep on using the lead field for the time being
Form Name |
---|
The problem here is that there is a trailing space for leadAccountId. The request has
"leadAccountId "
But it should have
"leadAccountId"