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
JIRA_DOMAIN
is your Jira domain e.ghttps://company.atlassian.net
.JIRA_USERNAME
is your Jira username.JIRA_API_KEY
is your Jira token which you can easily create in https://id.atlassian.com/manage/api-tokens.- Create
JiraSearch
object and set multiple jira issue ids to search using JiraSearch method. - JiraIssueReader is used to search and read the Jira issues.
- Job.run() is then used to transfer data from the
reader
to StreamWriter which will print the output to the console.