attach files via api in an issue from service now

Santiago Pedrosa Pérez September 20, 2021

We need to attach a file that we have in a servicenow task to a JIRA issue, the call that we are using.

curl --request POST \
--url https://urljira/rest/api/3/issue/ID-ISSUE/attachments \
--header 'Authorization: Basic yyyyyyyyyyyyyyyyyyyyyyyyyy' \
--header 'Content-Type: multipart/form-data; boundary=---011000010111000001101001' \
--header 'X-Atlassian-Token: no-check' \
--cookie atlassian.xsrf.token=xxxxxxxxxxxxxxxxxxxxxx n \
--form file=https://urlservicenow/api/now/attachment/Idfichero/file

 

We have verified that if instead of a link to the file in servicenow, we put a path C: \ XXX \ File.txt, the file is attached correctly.

some idea of how you could make the call to attach the file directly from servicenow.
Thank you

2 answers

1 accepted

0 votes
Answer accepted
Ajay _view26_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 20, 2021

HI @Santiago Pedrosa Pérez 

Welcome to the community!

The JiraAPI is working as expected. 

The problem here is "https://urlservicenow/api/now/attachment/Idfichero/file" is not a public link. You would need to use the ServiceNow API to download the file in a temp folder and then use the Jira REST API

 

Cheers

Ajay

0 votes
Vengadesh November 19, 2024

Hi @Santiago Pedrosa Pérez ,

How to achieve the above scenario.I want to move attachments from servicenow to jira

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events