The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JSON format to mark an issue as Duplicate of another issue in JIRA using JAVA code

Shal
April 30, 2021

Hello All

can someone please suggest the jsonObject format in below code, to mark one issue as duplicate of other in JIRA .

StringEntity entity = new StringEntity(jsonObject.toString(),ContentType.APPLICATION_JSON);

HttpUriRequest request = RequestBuilder.put()
.setUri("https://url/rest/api/2/issue/XTABC-641")
.setHeader(HttpHeaders.ACCEPT, "application/json")
.setHeader("X-Atlassian-Token", "no-check")
.setEntity(entity )
.build();

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

1 vote
Answer accepted
Thomas Deiler
Community Champion
April 30, 2021

Dear @Shal ,

User the REST endpoint: POST /rest/api/2/issueLink

The JSON data looks like this:

{
"type": {
"name": "Duplicate"
},
"inwardIssue": {
"key": "ABC-13"
},
"outwardIssue": {
"key": "ABC-7"
}
}

To get all possible link types use GET /rest/api/2/issueLinkType

So long

Thomas

Shal
May 1, 2021

Thanks a lot @Thomas Deiler.

It's working. I was using PUT method instead of POST.

I want to update "Status" and "Resolution" field as well, is it possible with suggested JSON update and  REST endpoint: POST /rest/api/2/issueLink .

Or I have to do new HTTP request with new JSON  and REST endpoint.