Forums

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

How to add a attachment while creating a issue in Node js

Karthikeyan N October 10, 2018

var jira = new JiraApi

('http', 'localhost', '8080', 'username', 'password', 'apiversion');
var linkData = {

"fields": {

"project":

{ "key": "TES" },

"summary": "First Issue1",

"description": "creating first issue1",

"issuetype":{ "name": "Bug" },

"priority": { "name": "Medium" }, },

"attachment":{ "name":"Test.docx", "path":"D://image//Test.docx", },

var options = {

rejectUnauthorized: jira.strictSSL,

uri: jira.makeUri('/issue'),

method: 'POST',

json: true,

body: linkData,
};
jira.doRequest(options, function (error, response)

{ console.log(response);

// res.json({  IsSuccess: true,  Message: "Success"  }); });

1 answer

0 votes
Nir Haimov
Community Champion
October 10, 2018

Hi @Karthikeyan N

You would have to create an issue, grab the issuekey then attach the attachment using /rest/api/2/issue/issuekey/attachments

Suggest an answer

Log in or Sign up to answer