Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Creation of JIRA tickets using Rest API

Casey Maynard
Contributor
August 14, 2018

I am hoping there is a way to use some add-on or feature with JIRA/Confluence that will allow my team to create a set of JIRA tickets with multiple fields, via a CSV (or some table that is created in Confluence).  Current these are the fields that I need to have JIRA cards created 

Project

Type

Summary

Description

Assignee

Timecode (custom field)

I have projects, and Epics already created. but I need to create about 50 User Stories and this takes awhile manually.

Someone suggested Rest API, but I cannot find a tutorial that is specifically related to only the JIRA card creation from a source file (.csv) file or some other 'table'.

Thanks

3 answers

0 votes
Arun_Thundyill_Saseendran
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 27, 2018

You can write a custom module of course to create issues using ReST. It is pretty straightforward.  I am sorry that I cannot share the code. However I can tell my approach.

My requirement was that I would have the data in some odd database even Oracle 7 once or on CSV. So I used a common interface and multiple implementations to read from multiple databases / data sources and then have it in-memory. I also supported multiple transformations and translations and then I set it to a POJO. POJO to JSON using Jackson. I had used Apache Web Client and Apache Web Utils along with Apache Commons, Apache Lang and Lang3. 

0 votes
Casey Maynard
Contributor
August 14, 2018

--

0 votes
Arun_Thundyill_Saseendran
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 14, 2018

If you want to create issues from CSV without using the Jira Importer Plugin then your approach is right. You have to go with ReST API provided by JIRA.

 

You can use a simple Python script or a simple app in JAVA that reads the CSV, iterates over each row - form the issue create JSON and just POST it. You can improvise as and how it is required to suit your needs.

Pseudocode will be as follows. I do not have my code base handy. So this is that I have now.

    

// Create Issue and make a post request
private void createIssueFromFile(String fileName)
{
issuesRestApiURL = ""; // You instance base URI

CsvReader reader = null;
reader = new CsvReader(new BufferedReader(new FileReader(RESOURCES_PATH + fileName)));
// read file using CSV Reader - OpenCSV is my choice
String[] line = null;
while ((line = reader.readLine()) != null)
{
// create Issue object (issueWrapper)
.....
.....
// create headers should set the headers right - You can use simple Basic Auth
HttpEntity<CreateIssueWrapper> request = new HttpEntity<CreateIssueWrapper>(issueWrapper, createHeaders());
// REST request
restTemplate.postForObject(issuesRestApiURL, request, IssueWrapper.class);
}
// close reader
reader.close();
}
Casey Maynard
Contributor
August 14, 2018

Where can I find the JIRA Importer Plugin?  Is this a reference to the Confluence feature to right click on text and use the 'Create JIRA issue' icon option?

Arun_Thundyill_Saseendran
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 16, 2018

JIRA importer's plugin is now part of the JIRA source code. You can find info about it here

However, I don't think it will satisfy your requirement.

Casey Maynard
Contributor
August 16, 2018

Yes we used that to import our Bugzilla issues, but determine it just created a havoc and not work the mess it created.

I am hoping that someone will determine if there are instructions on how to use REST API to create JIRA tickets.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events