Managing versions
We have seen how to add versions as a 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 a Java client for the REST API recipe.
How to do it...
A new version can be added into a project as follows:
Create a
VersionInput
object with the necessary details.VersionInput versionInput = new VersionInput("DEMO", "JRJC", "Test", new DateTime(), false, false);
Use the
createVersion
method onVersionRestClient
.Promise<Version> version = jiraRestClient.getVersionRestClient().createVersion(versionInput);
Once a version is created, you can retrieve it any time using the version URI.
Promise<Version> version = jiraRestClient.getVersionRestClient().getVersion(versionURI);
Given a version, you can update it by sending a new
VersionInput
object with updated parameters....