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

1 vote
Answer accepted
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
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. 

Suggest an answer

Log in or Sign up to answer