Search for Jira Issues by Multiple IDs

Updated: Jan 31, 2023

This example shows you how to search multiple Jira issues using DataPipeline.

Java Code Listing

package com.northconcepts.datapipeline.examples.jira;

import com.northconcepts.datapipeline.core.StreamWriter;
import com.northconcepts.datapipeline.jira.JiraIssueReader;
import com.northconcepts.datapipeline.jira.JiraSearch;
import com.northconcepts.datapipeline.job.Job;

public class SearchJiraIssuesByMultipleIds {

    private static final String JIRA_DOMAIN = "JIRA_DOMAIN";
    private static final String JIRA_USERNAME = "USERNAME";
    private static final String JIRA_API_KEY = "API_KEY";
    
    public static void main(String[] args) {
        JiraSearch jiraSearch = new JiraSearch();
        jiraSearch.searchIssuesById("AB-1", "AB-2", "AB-6"); // your JIRA ids

        JiraIssueReader reader = new JiraIssueReader(JIRA_DOMAIN, JIRA_USERNAME, JIRA_API_KEY, jiraSearch);
        Job.run(reader, new StreamWriter(System.out));
    }
}

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 JiraSearch object and set multiple jira issue ids to search using JiraSearch method.
  5. JiraIssueReader is used to search and read the Jira issues.
  6. Job.run() is then used to transfer data from the reader to StreamWriter which will print the output to the console.
Mobile Analytics