I want to make api call to JIRA from my small java app to get issue details and below are the few questions and points:
1) My Company JIRA runs on-> https://<companyname>.atlassian.net/jira
2) Domain name as mentioned having .atlassian.net not Jira
3) I have access to this JIRA tool using my user cred set username and password given to me
Now, I tried
Way 1:
String issueKey="SSK-91";
final URI jiraServerUri = new URI("https://<name>.atlassian.net");
final JiraRestClient restClient = new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(jiraServerUri, "spotthori@p.net", "Developer@123");
Promise<Issue> issuePromise = restClient.getIssueClient().getIssue(issueKey);
Way 2:
URI jiraServerUri1 = URI.create("https://<name>.atlassian.net");
AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
BasicHttpAuthenticationHandler auth = new BasicHttpAuthenticationHandler("spotthori@p.net", "Developer@123");
JiraRestClient restClient1 = factory.create(jiraServerUri1, (AuthenticationHandler) auth);
IssueRestClient issueClient1 = restClient1.getIssueClient();
Promise<Issue> issue=issueClient1.getIssue("SSK-91");
Both of these ways, I am not getting anything, I mean ended up with exception logs in console:
2022-08-19 13:56:47.133 ERROR 26912 --- [nio-8090-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.util.concurrent.ExecutionException: RestClientException{statusCode=Optional.of(401), errorCollections=[]}] with root cause
org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 1 of Basic authentication with passwords is deprecated. For more information, see: https://developer.atlassian.com/cloud/confluence/deprecation-notice-basic-auth/
at org.codehaus.jettison.json.JSONTokener.syntaxError(JSONTokener.java:439) ~[jettison-1.1.jar:1.1]
at org.codehaus.jettison.json.JSONObject.<init>(JSONObject.java:169) ~[jettison-1.1.jar:1.1]
at org.codehaus.jettison.json.JSONObject.<init>(JSONObject.java:266) ~[jettison-1.1.jar:1.1]
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient.extractErrors(AbstractAsynchronousRestClient.java:212) ~[jira-rest-java-client-core-5.2.1.jar:na]
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$2.apply(AbstractAsynchronousRestClient.java:175) ~[jira-rest-java-client-core-5.2.1.jar:na]
at com.atlassian.jira.rest.client.internal.async.AbstractAsynchronousRestClient$2.apply(AbstractAsynchronousRestClient.java:170) ~[jira-rest-java-client-core-5.2.1.jar:na]
at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:49) ~[atlassian-httpclient-api-2.0.0.jar:na]
at com.atlassian.httpclient.api.ResponsePromiseMapFunction.apply(ResponsePromiseMapFunction.java:10) ~[atlassian-httpclient-api-2.0.0.jar:na]
Recommended Learning For You
Level up your skills with Atlassian learning
Learning Path
Improve user experience across Jira with global settings
Learn how to set up and configure a Jira site, manage Jira permissions, and configure Jira apps and integrations.
Learning Path
Streamline projects across Jira with shared configurations
Build Jira work items with reusable configurations called schemes, and reduce administrative work with automation.
Learning Path
Become an effective Jira software project admin
Set up software projects and configure tools and agile boards to meet your team's needs.