Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to authenticate to Jira REST API and retrieving JSON data

Joshua Azicate September 10, 2019

I've been attempting for days on how to authenticate using login credentials and trying to retrieve specific JSON data for transitions in Jira. Can someone please help me with this one? If anyone can give me any pointers on what library is easiest to use and how I can I easily parse the JSON. Thanks!!!

String username = "username";
String password = "password";

Authenticator userAuthenticator = new Authenticator(username, password);
String client = ClientBuilder.newClient()
.target("http://jira.corp.local:8080")
.register(HttpAuthenticationFeature.universalBuilder()
.credentialsForDigest(username, password)
.build())
.path("/rest/api/latest/issue/ORI-5714/transitions?expand=transitions.fields")
.request(MediaType.APPLICATION_JSON)
.get(String.class);

System.out.println(client);

 

1 answer

0 votes
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2019

Hi @Joshua Azicate 

First question to ask is whether this is a cloud or server version of Jira - the answer to this will decide how to proceed.

Joshua Azicate September 12, 2019

Using the server version of Jira

Suggest an answer

Log in or Sign up to answer