Hi Team,
I am trying to create /Update /Delete Jira service Desk Issue using Jira Rest Client But it failed to Authenticate. Can you please provide sample java code to create Java Service desk issue using Jira Rest Client .
Thanks in Advance !
Regards,
Yogesh
Hi Yogesh,
You can try below code.
public static void main(String[] args) throws Exception {
System.setProperty("javax.net.ssl.trustStore", "C:/Demo/myTrustStore");
URI jiraServerUri = URI.create("https://local.jira.com/");
AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
AuthenticationHandler auth = new BasicHttpAuthenticationHandler("username", "password");
JiraRestClient restClient = factory.create(jiraServerUri, auth);
IssueRestClient issueClient = restClient.getIssueClient();
try {
IssueInputBuilder iib = new IssueInputBuilder();
iib.setProjectKey("PROJECT-KEY");
iib.setSummary("Test Summary");
iib.setIssueType(getIssueType());
iib.setDescription("Test Description");
iib.setPriorityId(3L);
iib.setAssigneeName("Purus");
iib.setReporterName("Godwin");
iib.setDueDate(new DateTime());
iib.setFieldInput(new FieldInput("cust_field_5445", "Custom Value 1"));
iib.setFieldInput(new FieldInput("cust_field_599", ComplexIssueInputFieldValue.with("value", "Testing")));
iib.setFieldInput(new FieldInput(IssueFieldId.COMPONENTS_FIELD, "value"));
IssueInput issue = iib.build();
BasicIssue issueObj = issueClient.createIssue(issue).claim();
System.out.println("Issue " + issueObj.getKey() + " created successfully");
} finally {
restClient.close();
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.