Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Ability to fetch attachments from Jira issue and send to Freshservice via Rest API

Ward Schwillens_ Schwillie
Contributor
October 6, 2023

I am working out the Rest API integration with our company's Freshservice cloud. I am able to create a Jira issue from Freshservice in Jira software (Cloud) and send updates in both directions. 

The hump I encounter relates to sending over an attachment that is attached to the Jira issue to Freshservice, as Freshservice API needs a file location to fetch the attachment from. 

Is there a way in Jira automation to fetch a (the latest) added attachment from the Jira issue, and store it somewhere, E.g. on a Sharepoint folder and then call the Freshservice API that get's it and uploads that attachment in the Freshservice ticket or in a note to the ticket? 

 

Thanks for your suggestions!

1 answer

0 votes
Erin Quick-Laughlin
Contributor
October 6, 2023

I believe you can pull attachments if the FS user account has permissions, using the rest path in  https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-attachment-content-id-get 

Haven't used it myself, but PostMan seems to return a file. 

To get attachment IDs, I would try #1 if automation is initiated in FS, #2 if initiated in Jira

1. first make a call using the rest path in  https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-get  which returns JSON that will include an array of attachments and their IDs

-or-

2. send over the ID(s) from JIra when pushing to FS 

I'm not sure about how to get the last attachment.  The closest I could find (for the Jira Automation side) was this:  https://community.atlassian.com/t5/Jira-Software-questions/Get-last-added-attachment-to-issue-using-smart-values/qaq-p/1479825#M123079 but it looks like it didn't work for them as expected since .last refers to the place in the list, not the greatest ID.

HTH!

Erin

Ward Schwillens_ Schwillie
Contributor
October 8, 2023

Hi Erin,

Thank you for your response. I am able to fetch the attachment from the Jira issue, with it's ID, the type etc. The problem that I have is that I cannot store it with automation on a filesystem path from where I can fetch it again for the second part of my function, that is is sending the attachment in a note to FreshService. The FreshService API needs a file path to fetch the attachment from. 

I did not discover that ability in the Rest API documentation that you shared, or might I have missed that? 

 

Thank you for your help!

Erin Quick-Laughlin
Contributor
October 9, 2023

You didn't miss anything - I missed the requirement that FS needs a filepath. 

What about using PowerAutomate to get the attachment via API and push it to Sharepoint or OneDrive?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events