using rest API to create Jira story and assign it to "Unassigned"

danihuan June 29, 2023

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?

3 answers

0 votes
Tchad Rogers
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 10, 2024

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 }

0 votes
David Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 29, 2023

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?

danihuan June 30, 2023

Hi @David Bakkers 

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!

David Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 4, 2023

Did it work? If so, please mark the answer as correct.

danihuan July 17, 2023

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'.

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 29, 2023

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.

danihuan June 29, 2023

Hi @Trudy Claspill 

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
}
}

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 30, 2023

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?

danihuan June 30, 2023

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.

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 30, 2023

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.

danihuan July 17, 2023

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)"

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events