Reputation: 41
I would like to use Unirest Java libraries for accessing Jira Cloud. Can you share any code snippets? Thank you.
Upvotes: 0
Views: 978
Reputation: 339
First add the Unirest dependency to your pom.xml (for Maven):
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
</dependency>
Then use the following syntax to query JIRA Cloud. Replace yourjira with your instance name and replace with your username and password.
HttpResponse<JsonNode> response = Unirest.get("https://yourjira.atlassian.net/rest/api/2/search?jql=").basicAuth("username","password").asJson();
System.out.println(response.getBody());
More specific JIRA Cloud REST API syntax can be found here: https://docs.atlassian.com/jira/REST/cloud/
Upvotes: 1