I followed this article https://confluence.atlassian.com/jirakb/how-to-set-assignee-to-unassigned-via-rest-api-in-jira-744721880.html.
Tried both
```
"assignee": { "name": "-1" }
```
and
```
"assignee": { "name": null }
```,
but the newly created story is always assigned to myself.
I've also tried ```"assignee": null``` and got the same result.
Anyone has any luck creating an "Unassigned" story?
I know this is an old thread... I found it while investigating this same issue, so I thought I'd post what worked for me.
I'm using V2 of the API on Jira Data Center Edition (not Cloud), and scripting in Python. I set the "assignee" key to None (Null in other languages), and found that it did correctly set the Assignee to Unassigned, in a project that has a Default Assignee.
This works:
"assignee": null
This does not work:
"assignee": { "name": null }
Hello @danihuan
For Jira CLOUD, when you create the issue, if you do not set the assignee (IE, totally omit the assignee object from the body of the request) the assignee will be 'unassigned', unless a default assignee for all Issues has been set in the Project settings.
Have you also checked to see if an automation rule on that Project isn't setting the Assignee to you?
Also, are you 100% sure you're not confusing the Issue Assignee with the Reporter?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, I am certain this is Assignee, not Reporter. :)
I think there is a default assignee. But I don't think I have the privilege to see that particular configuration. I'll give it a try with omitting the assignee object to verify.
Thanks for the tip!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did it work? If so, please mark the answer as correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can confirm that by omitting the assignee object, the issue created is assigned to the default assignee. So this won't work for me as I want it 'unassigned'.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @danihuan
Welcome to the Atlassian community.
Are you using the API to try to set the assignee to Unassigned after you have completed creation of the issue, or are you trying to set the assignee to Unassigned in the same API call that creates the issue?
It should also be noted that the article is from the Jira Server KB, not the Jira Cloud KB. It may not apply to the Jira Cloud API.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am setting the assignee and creating the issue in one call, using the endpoint /rest/api/2/issue.
Payload looks like:
{
"fields": {
"project": {
"key": "CDMG"
},
"parent": {
"key": "CDMG-1812"
},
"issuetype": {
"name": "Story"
},
"summary": "[DnA - DDC] an awesome story",
"description": "something awesome",
"priority": {
"id": "3"
},
"assignee": { "accountId": "-1" } <--- also tried null
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there a reason you are using v2 rather than v3?
Are you able to create an issue in this project through the UI and have the Assignee set to Unassigned?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
only reason is I am not aware of v3. :) Do I just change the endpoint to /rest/api/3/issue to use v3? I suppose the payload schema remains the same?
Yes, using UI I can create an issue and set it to Unassigned. Thanks for the question, I'll inspect the request made from UI and see what I can find.
I checked again by inspecting the payload when using UI to create a new issue. If I set the assignee to unassigned, the payload has "assignee": null. However, the issue created is assigned to myself. So it seems that there is no way to created an "unassigned" issue with the REST API.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, just change the endpoint from "2" to "3". In most cases the payload won't change but you could double check that against the documentation.
Take a look at the other Answer to your post also. Confirm that you don't have an Automation Rule changing the Assignee after issue creation is completed. And try omitting the Assignee field from the payload entirely.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I need to stick with v2 because v2 allows markups in some field where v3 requires an Atlassian Document obj.
For such field, in v2, I can have something like
"customfield_10033": "* piont 1\n* point2"
where v3 would give error "Operation value must be an Atlassian Document (see the Atlassian Document Format)"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.