Jira v8.2.1 REST API

MartinMJFA September 3, 2019

I'm trying to talk to a self hosted (Server?) jira instance via rest, from a scala /java application.

There's so much clutter out there and a lot of old information.

I'm thinking this should be really simple, and there would be a sample application, that "just works".

I've tried using apache httpclient basic auth, as in this example  https://hc.apache.org/httpcomponents-client-4.5.x/httpclient/examples/org/apache/http/examples/client/ClientAuthentication.java

but am getting 400 code returned.

I can request successfully using postman.

 

 

2 answers

0 votes
MartinMJFA September 3, 2019

I've also looked at JIRA REST Java Client Library but it seems to be obsolete/ 9 years old!!

0 votes
DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 3, 2019

I personally use this library and it works fine all the time. kong.github.io/unirest-java

This is really simple to use. Code looks like this,

HttpResponse response = Unirest.get("{jira_url}/rest/api/2/issue/{issueIdOrKey}")
  .header("Accept", "application/json")
.basicAuth("{user_name}", "{password}") .asJson(); System.out.println(response.getBody());
MartinMJFA September 3, 2019

Cheers - I'll take a look...

Suggest an answer

Log in or Sign up to answer