i want to clone issue project A to project B via JIRA REST API.
is there any solution directly use JIRA REST API?
if no solution, I'd like to try cloning in the way below.
please give me good opinions, thank you
<second solution>
1) all ticket search from project A (using rest/api/2/search)
2) create issue to project B (using above ticket list AND using rest/api/2/issue)
Hi,
There is no api to clone issue. You need to get the data of each issue
GET /rest/api/2/issue/{issueIdOrKey}
Then create a new issue in the project B.
POST /rest/api/2/issue
https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue-createIssues
Thank you Mohamed,
i also agree :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
/rest/internal/2/issue/issue-key/clone
Post?
-Body "{"summary":"CLONE - test","optionalFields":{},"includeAttachments":true}"
Not found in API documentation? catch with developer console.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This does not seem to work and yields HTTP error 404. Can you please elaborate about under which circumstances and in which Jira versions (8.22.x for me) this API can be used? Maybe you have a working example in Java or at least a curl command for the community here. I am a normal user without admin rights (only project admin) or access to whatever this developer console is supposed to be.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @kriegaex This works for me in Jira Cloud, basically what I'm doing is clone an issue for test and then catch the API call that clones the issue in the browser's developer console, I'm not sure if that's the case for Jira DataCenter but you can try the steps I described above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh OK, you just mean the browser's developer console. I mistook your hint for being about a dedicated tool for Jira developers. Unfortunately, in the data centre version of Jira, what the browser does is not so clear. It does no simply send a REST call to an internal end point like the one which seems to work in the cloud version. At least, it is not something I can easily identify in the "network" tab. Instead, it does some JS magic and XHR stuff. I do not feel so inclined to debug that with an uncertain outcome, not being a JS buff.
Anyway, thanks for trying to help me. I hope that someone else comes up with a way to do this. For now, I am using the Jira Java REST API library, for which I have hacked a simple "deep clone" for my own purposes, focusing on the fields I need to be cloned. Tha is not a generic solution, but serves my purpose. It would be better if Atlassian would expose the clone functionality in their public REST API, though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @kriegaex something just crossed my mind, and I hope it can help you, you can actually make a webhook that could trigger an automation rule that clones your ticket.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Teodor Hoza Thank you. Works for me in Jira Cloud too.
Scriptrunner script:
def issueResult = post('/rest/internal/2/issue/[issue key]/clone')
.header('Authorization', 'Basic [your base64 endcoded user:token ]')
.header("Content-Type", "application/json")
.body([summary : "CLONE - test"]).asString()
return issueResult
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @JJJ,
You can also try our Jira cloud app Deep Clone for Jira.
It's possible to bulk clone thousands of issues at once and move them to other projects or instances. With the Deep Clone REST API you can automate cloning issues with your scripts.
We offer many other advanced cloning features that might be helpful for you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marlene
I'm using Deep Clone REST API to clone issues between projects.
But just single issues. Is there any way to clone a task and ALSO all its subtasks? (deep clone)
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Javier Gonzalez Gonzalez,
Sorry for my late reply.
I've seen that you already got feedback from our support team.
For everybody else who's reading along: When cloning with the Deep Clone REST API, it is not possible to clone an issue with all its subtasks with a single request. You need to do one request per issue. For the subtasks, you need to set parentKey
as the key of the cloned parent issue.
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.
@Marlene Kegel - codefortynine it has no sense for me. You can DEEP clone using your app, but no using the API. It happens also for checklists, are not cloned for a cloned task using API.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@kriegaex Deep Clone offers advanced features that either don't exist in Jira or require complex configuration. Over the years, Jira has made some progress in this area. For instance, it's now possible to clone attachments, which was not an option for several years as far as I know.
I've attached the Deep Clone config, so you have a better understanding what you can clone or modify with our app. Most fields can be edited in the "Field Editor", some also with Jira Expressions.
@Javier Gonzalez Gonzalez I am sorry if you experienced an issue while working with Deep Clone for Jira. If you reach out to our support, I am sure they can help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Marlene Kegel - codefortynine Deep Clone is really nice app, but it's a missfunction for us not being able to DEEP clone, subtasks and complete structure, as the app does.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm sorry that you haven't been able to solve your use case with Deep Clone for Jira.
You could also try to automate cloning using the Deep Clone Post Function in combination with Jira Automation. If you don't want to change the status in order to clone an issue, you can work with looping transitions.
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.