Managing versions

We have seen how to add versions as fix for versions or affected versions on an issue. But how do we create those versions using REST? In this recipe, we will see how to create versions in a project and manage them using JRJC!

Getting ready

As usual, create a JIRA REST client as mentioned in the Writing Java client for REST API recipe.

How to do it...

A new version can be added into a project as follows:

  1. Create a VersionInput object with the necessary details:
            VersionInputversionInput = new VersionInput
            ("DEMO", "JRJC", "Test", new DateTime(), false, false);
  2. Use the createVersion method on VersionRestClient:
            Promise<Version> version = 
            jiraRestClient.getVersionRestClient().createVersion(versionInput);

Get JIRA Development Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.