Writing Java client for REST API
In this recipe, we will quickly see how we can create a Java client to communicate with JIRA using the REST APIs.
Getting ready
Make sure Accept Remote API Calls option is turned ON in JIRA under Administration | Global Settings.
How to do it...
In order to connect to JIRA using REST APIs, Atlassian has developed a JIRA REST Java Client Library, called JRJC in short. It provides a thin layer of abstraction on top of the REST API and related HTTP(S) communication and gives a domain object model to represent the JIRA entities, such as issues, priorities, resolutions, statuses, users, and so on. The REST API and the JRJC Library are in alpha phase and are quickly evolving! The status of the library can be viewed at: https://studio.atlassian.com/wiki/display/JRJC/Home.
We will be using JRJC to connect to our JIRA instance using the standalone Java program. Following are the steps:
Create a Maven project and add the JRJC dependency to the
pom.xml
file.<dependency...