Add Jira Comments

Updated: Jan 31, 2023

This example shows you how to add a comment to a Jira issue using DataPipeline.

Java Code Listing

package com.northconcepts.datapipeline.examples.jira;

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

public class AddJiraComments {

    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.addIssueComment(JIRA_ISSUE_ID, "What is the progress on this issue?");
        System.out.println(record);
    }
}

Code Walkthrough

  1. JIRA_DOMAIN is your Jira domain e.g https://company.atlassian.net.
  2. JIRA_USERNAME is your Jira username.
  3. JIRA_API_KEY is your Jira token which you can easily create in https://id.atlassian.com/manage/api-tokens.
  4. Create JiraService using above properties.
  5. For given JIRA_ISSUE_ID , the comment will be posted.
  6. JiraService.addIssueComment(String issueId, String comment) method is used to add the comment to a given issue id.
Mobile Analytics