Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to specify key when creating issue via API?

David Baumgold June 18, 2014

I have some issues on an old OnDemand instance that I want to transfer to a new OnDemand instance, and I can't use the bulk import/export feature for various reasons (primarily because it clobbers all existing issues in the new instance). I want to use the REST API to grab issue information from the old instance and create equivalent issues on the new instance, and ideally, I'd like to keep the issue keys the same -- so that issue ABC-123 on the old instance is still issue ABC-123 in the new instance. Is it possible to specify the key when you create a new issue? (I tried using a PUT request on the URL with the issue key, and it wouldn't allow me to create the ticket when it didn't exist.)

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Vijay Khacharia
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 19, 2014

I dont think you can provide issue key that you want to create. You can simulate that though using your code.

What I did was to read the old instance, sort all issues by issue key, read one by one and create them in new instance. If the issue keys are not sequencial, you need to do a check and create dummy tasks in new instance for missing issue keys in old instance. Once all is done, delete all the dummy tasks from new instance.

Another option would be to update the DB directly after creating all the tasks with rest api.

You will need to update the issuenum field in jiraissue table for each issue that doesnt have correct issue key. Then you have to update the project table to put the highest issue key that is created for that project, so next task gets created correctly.

Vijay

0 votes
Emmanuel BAYSE
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 4, 2014

Hi, I think I have an similar question to David. Indeed, I use JIRA CLI (Command Line Interface) in order to create Issue to a new JIRA, but I want to keep/to choose the issue key when I use the function create Issue in the target JIRA. Currently, the issue key is generated automatically. Regarding this point, did you able to progress as far ? to find a workaround ?

Thanks,

Emmanuel

 

David Baumgold December 4, 2014

No, I don't think it's possible.

TAGS
AUG Leaders

Atlassian Community Events