I am trying to call JIRA REST API from Java function and I am not really sure how to do it.
Currently, I am using something like
String baseURL = ComponentAccessor.getApplicationProperties().getString(APKeys.JIRA_BASEURL);
String address = baseURL + "/rest/api/2/issue/" + issueID;
URL url = new URL(address);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
which fails on authorization (401). I have found some suggestions to include encoded login and password to the request, but I would like to use the current logged user.
I found some tutorials for JIRA REST Java Client, but cant seem to get it working.
Can someone point me out to some simple example of calling internal REST API using logged users credentials? If such thing is even possible.