Working with issues
So far we have seen how to write the clients for REST, SOAP, and XML/RPC methods. Now it is time to move on to some real examples. In this recipe, we will have a look at creating an issue using REST APIs.
Getting ready
Create a JIRA REST client as mentioned in the Writing a Java client for the REST API recipe.
How to do it...
The following are the steps to create an issue with the standard fields populated on it:
As mentioned in the Writing Java clients for the REST API recipe, initialize the Rest client:
final AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory(); final URI uri = new URI("http://localhost:8080/"); final JiraRestClient jiraRestClient = factory.createWithBasicHttpAuthentication(uri, "userName", "password");
Retrieve the
IssueRestClient
fromJiraRestClient
as we are dealing with issues in this recipe:IssueRestClient issueClient = jiraRestClient.getIssueClient();
Initialize the
IssueInputBuilder
object using the project key,issuetype...