Forums

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

How to mark an issue as Dupplicate of other in JIRA using JAVA code

Shal April 30, 2021

Hi All,

 

I am new to this

I am tring to mark an issue as duplicate on another in JIRA.

String jsonRequest = "{\"update\":{ \"issuelinks\":[{\"add\":{\"type\":{\"name\":\"Duplicate\"},\"inwardIssue\":{\"key\":\"XTABC-123\"},\"outwardIssue\":{\"key\":\"XTDEF-456\"},\"comment\":{\"body\":\"Duplicate of XTDEF-456\"}}}]}}";

many people have suggested to use JSON object instead of String

converted it to Json object

final Gson gson = new GsonBuilder().setPrettyPrinting().create();
Object jsonObject = gson.fromJson(jsonRequest, Object.class);

but got this error

{"errorMessages":["Unexpected character ('u' (code 117)): was expecting double-quote to start field name\n at [Source: org.apache.catalina.connector.CoyoteInputStream@12cc67c1; line: 1, column: 3]"]}

 

Please suggest where i am getting wrong.

1 answer

0 votes
Gonchik Tsymzhitov
Community Champion
April 30, 2021

Hi @Shal , 

Did you check the string jsonRequest is json convertible ? 

Because as I see you can generate in other way

https://www.javatpoint.com/java-json-example

Shal April 30, 2021

Thanks for reply  @Gonchik Tsymzhitov 

Is the added fields inside update in jsonRequest enough to mark one issue as duplicate of other?

Suggest an answer

Log in or Sign up to answer