In this recipe, we will see how to manage comments on an issue.
Adding a comment on an issue using REST API is pretty easy!
Retrieve the issue on which the comment needs to be added and retrieve the user who needs to make the comment:
final Promise<Issue> issue = jiraRestClient.getIssueClient().getIssue(key); Issue browsedIssue = issue.get(); User jobin = jiraRestClient.getUserClient().getUser("jobinkk").get();
Create a
Comment
object using issue URI, comment text, author, time of the comment, and so on. You can optionally add visibility information as well, similar to what we have seen while adding worklogs. Leave the visibility null if the comment is visible to all:Comment comment = new Comment(null, "Test Comment", jobin, null, new DateTime(), null, new Visibility(Type.GROUP, "jira-developers...