Hi,
I am trying to save an attachment through REST API to an issue, using node.js
var options = {
hostname: 'testserver.com, port: 443,
path: '/rest/api/2/issue/SH-488/attachments',
method: 'POST',
rejectUnauthorized: false,
strictSSL: false,
headers: {
'Authorization': 'Basic ' + new Buffer("username" + ':' + "pasword").toString('base64'), 'Accept': 'multipart/form-data',
'X-Atlassian-Token': 'no-check' },
formData: { "file" : attachment }
};
var req = https.request(options, function (res) {
res.setEncoding('utf8');
res.on('data', function (body) {
console.log('Body2: ' + body);
}); });
but I am not getting any response (no response or error) , could someone help
Hey Ranjith,
It's been a while since I've worked with node and nothing jumped out at me while I read through your code. I find that sometimes it's easier to start with a "known good" call and modify from there.
There's another post on Community where someone posted their working node.js code to do just this - that's a good starting point and all you'll need to update is the server address / credentials and the file you want to upload.
Cheers,
Daniel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.