Upload attachment to JIRA using REST API from ServiceNow

Andre May 9, 2022

I have tried looking at the documentation, however, I could not find all the details I need, thus hoping someone would be able to provide some guidance.

We have - ServiceNow and JIRA on prem (server) and we can create issues in the instance.

When trying to upload an attachment form a ServiceNow incident, it all fails.

This is what we have so far (javascript):

try { 
var r = new sn_ws.RESTMessageV2('Jira Outbound Integration OnPrem', 'POST ATTACHMENT'); r.setStringParameterNoEscape('instanceName', 'JIRAPROD');
//file as base64 or we can pass the url https://instance.service-now.com/sys_attachment.do?sys_id=53ae1bdb4510c0852022604bcb2c r.setStringParameterNoEscape('contentJSON', '{"file":"c21hbGwgdGV4dCBmaWxl"}'); r.setStringParameterNoEscape('issueID', 'JACK-6738');
//url for the REST call in the end looks like https://JIRAPROD/jira/rest/api/latest/issue/JACK-6738/attachments var response = r.execute(); var responseBody = response.getBody(); var httpStatus = response.getStatusCode(); } catch(ex) { var message = ex.message; }

 

The file is stores in the instance and can be anything. We can get the file name as well if needed for the call.

2 answers

0 votes
Krishanu June 29, 2022

Hi @Andre did you manage to post attachment from ServiceNow? Could you please share the solution here?

0 votes
Diana_Architect_ZigiWave
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 10, 2022

@Andre hi and welcome. Sorry to hear that you're facing such difficulties. Do you use any tool to make the connection between Jira and ServiceNow? If not and you're open to the idea of using such, I'd like to propose a possible solution. It's a no-code integration tool, called ZigiOps. It reads the schema dynamically, can transfer various data (such as the attachments you want to send), and sync default and custom fields. Also, you can customize it to fit your particular use case. Feel free to take a look at it and if you want to see how it works - you can always book a demo.

Regards, Diana (ZigiWave)

Andre May 12, 2022

Thank you, Diana. I appreciate the offer, however, this is not the solution we are looking at at the moment to implement in our environment. 

Andre

Diana_Architect_ZigiWave
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
May 17, 2022

@Andre sorry for the delayed reply. I totally understand. 

Suggest an answer

Log in or Sign up to answer