Read Jira Comments

Updated: Jan 31, 2023

This example shows you how to read comments for a Jira issue using DataPipeline.

Java Code Listing

 * Copyright (c) 2006-2023 North Concepts Inc.  All rights reserved.
 * Proprietary and Confidential.  Use is subject to license terms.
package com.northconcepts.datapipeline.examples.jira;

import com.northconcepts.datapipeline.core.Record;
import com.northconcepts.datapipeline.jira.client.JiraService;

public class ReadJiraComments {

    private static final String JIRA_DOMAIN = "JIRA_DOMAIN";
    private static final String JIRA_USERNAME = "USERNAME";
    private static final String JIRA_API_KEY = "API_KEY";

    private static final String JIRA_ISSUE_ID = "ISSUE_ID";
    public static void main(String... args) {
        JiraService service = new JiraService(JIRA_DOMAIN, JIRA_USERNAME, JIRA_API_KEY);
        Record record = service.getIssueComments(JIRA_ISSUE_ID);

Code Walkthrough

  1. JIRA_DOMAIN is your Jira domain e.g
  2. JIRA_USERNAME is your Jira username.
  3. JIRA_API_KEY is your Jira token which you can easily create in
  4. Create JiraService using above properties.
  5. For given JIRA_ISSUE_ID , comments will be read.
  6. JiraService.getIssueComments(String issueId) method is used to fetch all the comments for a given issue id. This method returns a record with all the comments with details.
  7. Print this record containing all the comments.

Sample Console Output

Record (MODIFIED) (has child records) {
        Record (MODIFIED) (is child record) {
            0:[author]:STRING=[Jane Doe]:String
            1:[body]:STRING=[What is the progress on this?]:String
        Record (MODIFIED) (is child record) {
            0:[author]:STRING=[John Doe]:String
            1:[body]:STRING=[This is currently in progress.]:String
        Record (MODIFIED) (is child record) {
            0:[author]:STRING=[Jane Doe]:String
            1:[body]:STRING=[Let's discuss this in our next meeting]:String

All Examples

Mobile Analytics