JIRA API: Creating a new issues with an issue key number that I assign

JudeLabs August 18, 2021

Can I create a new issue using the API,  where I can assign the issue key value?

For example;

My Project ID is "DEMO"

I want to create an issue in this project and assign it a key of "DEMO-123".  This is the only issue in this project.

The interesting thing is that I can do this when I do an import with an xls,  but I can not figure out how to assign a specific key of "DEMO-123" when I create an issue using the API.

POST /rest/api/2/issue

https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue-createIssue

I looked at the createmeta and nothing is standing out as far as what I can use if this is possible.

 

1 answer

1 accepted

2 votes
Answer accepted
Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 18, 2021

Hi @JudeLabs 

No, it's not possible, the issue id is auto generate and increment base already existing id's, you can't set it on your own

JudeLabs August 18, 2021

ok thanks,  that's what I thought.  I just think it strange that you can assign IDs that you want when you use the import function.

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 18, 2021

When using the import function, mentioning issue ID is just to tell the import mechanism to update existing issue.

If there is no issue with that key it will do nothing for that raw or create a new issue

Like Nic Brough -Adaptavist- likes this
John Roberts-Davies July 26, 2023

Hi Nir

I sometimes use the 'external system import' function to deliberately create an issue with a specific issue key. This works, if I specify the issue key in the csv file, and map that to the issue key field.

In my experience Jira server and data centre do not generate the next available key, if a valid key is entered in the csv file.

The next issue created using the standard web gui interface will be given a key that is 1 number higher than the one I imported.  

So I assume the Jira API must have the ability to do this, or am I missing something here?

Thanks

John

Luís GÓIS June 13, 2024

Hi John.

I have the same exact doubt. We also import CSVs to explicitly define the new issue's key, but can't find a way to do it via REST. Have you found any alternative? 

Thanks,
--
Luis

John Roberts-Davies June 13, 2024

Hi Luis

No, I still use csv import.

Luís GÓIS June 13, 2024

!:(

I'm considering "importing a CSV" with 499999 rows to create enough "placeholders" to allow me to choose the issue key I want to use via REST. Sounds dumb, but there's no way to automate the CSV import ...

John Roberts-Davies June 13, 2024

I did the same a few years ago, to reserve a range of key IDs. Still using that project now.

Suggest an answer

Log in or Sign up to answer