Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,341
Community Members
 
Community Events
165
Community Groups

Upload attachment to JIRA using REST API from ServiceNow

Andre I'm New Here May 09, 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 I'm New Here Jun 29, 2022

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

@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 I'm New Here 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

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

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you