Hello.
We have built a "synchronization" tool, based on the Jira REST API, which allows us to create or update issues based on "exports" from any other tool.
Now we are thinking about migrating a Jira project (+ Confluence & Bitbucket with references to Jira) from one server to another.
For that reason, the issue-keys (explicitly the number; e.g. PROJ1-12345, must be kept, in order to being able to keep the references working).
But, it seems, the REST API does not support setting the key during create.
We already tried in the JSON payload a "key": "PROJ1-12345", beside of the "fields" section. It seems to be ignored anyway.
Is there a possibility to set the issue key, during create with REST API?
Another thing we tried, is with the Java API.
We manipulated a MutableIssue Item with setNumber() and setProjectObject() and stored and reindexed it with the appropriate functions.
But also this did not work on already existing issues.
Might it be the case, that those setters are only good while creating issues, but not for "editing"?
Now i also tried to create an issue from scratch by Java API.
My code looks like (so, i'm more or less copying over attributes from an existing issues).
But, i do set the number actively.
long nr=999
def origIssue = issueItem.getIssueObjectByKey("TSTX1-1")
def newIssue = ComponentAccessor.getIssueFactory().getIssue()
newIssue.setProjectObject(origIssue.projectObject)
newIssue.setNumber(nr)
newIssue.setIssueType(origIssue.issueType)
newIssue.setSummary(origIssue.summary)
newIssue.setDescription(origIssue.description)
def created = ComponentAccessor.getIssueManager().createIssueObject(currentUser, newIssue)
After having the created object saved to the DB, i unfortunately has the next free number instead of the give 999.
I'm clueless what this methods should do and how to actively set the number as required.