@@ -0,0 +1,2102 @@
+package jira;%0A%0Aimport java.io.File;%0Aimport java.util.List;%0A%0Aimport org.json.JSONException;%0Aimport org.json.JSONObject;%0A%0Aimport com.jayway.restassured.RestAssured;%0Aimport com.jayway.restassured.authentication.AuthenticationScheme;%0A%0Aimport static com.jayway.restassured.RestAssured.get;%0Aimport static com.jayway.restassured.RestAssured.given;%0Aimport static com.jayway.restassured.RestAssured.preemptive;%0A%0A%0A%0Apublic class Issue %7B%0A%0A%09protected final static AuthenticationScheme auth = preemptive().basic(%22rgates%22, %22password1%22);%0A%09protected final static String apiURI = %22http://localhost:8079/rest/api/latest/%22;%0A%09%0A%09//Jira Key eg KT-123%0A%09protected final String issue;%0A%09%0A%09public Issue(final String issue)%0A%09%7B%0A%09%09this.issue = issue;%0A%09%7D%0A%09%0A%09public static void linkIssues(final String type, final String inwardIssue, final String outwardIssue)%0A%09%7B%0A%09%09final JSONObject obj = new JSONObject();%0A%09%09final JSONObject typeObj = new JSONObject();%0A%09%09final JSONObject inwardIssueObj = new JSONObject();%0A%09%09final JSONObject outwardIssueObj = new JSONObject();%0A%09%09%0A%09%09try%0A%09%09%7B%0A%09%09%09obj.put(%22type%22, typeObj);%0A%09%09%09typeObj.put(%22name%22, type);%0A%09%09%09obj.put(%22inwardIssue%22, inwardIssueObj);%0A%09%09%09inwardIssueObj.put(%22key%22, inwardIssue);%0A%09%09%09obj.put(%22outwardIssue%22, outwardIssueObj);%0A%09%09%09outwardIssueObj.put(%22key%22, outwardIssue);%0A%09%09%7D%0A%09%09catch (final JSONException e)%0A%09%09%7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09%0A%09%09RestAssured.baseURI = apiURI;%0A%09%09RestAssured.authentication = auth;%0A%09%09%0A%09%09given().contentType(%22application/json%22).and().body(obj.toString()).then().post(%22issueLink%22);%0A%09%7D%0A%09%0A%09%0A%09public List%3CString%3E getAttachmentIds()%0A%09%7B%0A%09%09RestAssured.baseURI = apiURI;%0A%09%09RestAssured.authentication = auth;%0A%09%09%0A%09%09return get(%22issue/%22 + issue).andReturn().jsonPath().getList(%22fields.attachment.id%22);%0A%09%7D%0A%09%0A%09public void addAttachment(final File attachment)%0A%09%7B%0A%09%09final String url = String.format(%22issue/%25s/attachments%22, issue);%0A%09%09%0A%09%09RestAssured.baseURI = apiURI;%0A%09%09RestAssured.authentication = auth;%0A%09%09%0A%09%09System.out.println(%0A%09%09%09%09given().header(%22X-Atlassian-Token%22, %22nocheck%22).and().multiPart(attachment)%0A%09%09%09%09%09.and().log().all().when().post(url).andReturn().statusLine()%0A%09%09);%0A%09%7D%0A%7D%0A

Create Issue.java