Multipart/form-data attachment pusg using Rest API from Snow->Jira

Ashish Avinav
Tera Contributor

Hi All,

 

We are integrating ServiceNow  with JIRA .We are facing issue with attachment push from SNOW->JIRA.

As we have to use Content-Type as "multipart-form-data", am not able to set request with attachment that need to be send.

Seems like setRequestBodyFromAttachment('sys_id') is not working, as its returning Http Status -200, but no response object.

 

Below script am using:

 

try
{
var req = new sn_ws.RESTMessageV2('Jira Integration Attachment', 'Post Attach');
req.setStringParameterNoEscape('key', event.parm1);
req.setRequestHeader("X-Atlassian-Token","no-check");
req.setRequestHeader("Content-type","multipart/form-data;boundary="+file[i].id); // file[i].id- sys id of attachment
req.setRequestHeader("Accept","application/json");
req.setMIDServer('mid-sever name);
req.setEccParameter('skip_sensor', true);
req.setStringParameter("file",file[i].name); // name of file
req.setRequestBodyFromAttachment(file[i].id); // sys id of attachment

var res= req.execute();

var resBody= res.getBody();
}

catch(ex)
{
gs.log("exception : "+ex);
}

 

 

Please help with this.

Thanks,

Ashish Avinav

10 REPLIES 10

Rupesh Ram Chi1
Tera Contributor

Hi @Ashish Avinav 

Is your issue resolved ? may i know how did u able to resolve ur issue ? we are working on the integration now and we have same requirement to send attachments to jira from SN through POST attachment api.

 

Please give me an high level idea how your issue got resolved. Thank you in advance.