Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to pull Comment Attachments with the Rest API?

sergio.figueroa@escala24x7.com March 18, 2021

Hi, we are building an integration process between our Jira Service Desk instance and another support platform.... We've managed to build automation rules that trigger some events and using the Rest API we pulled the necessary information to push it into the other platform. 


Unfortunately with the comments, although I'm detecting that the body it's composed of text, images and/or files, I'm not being able to actually pull the content of the file because the ID given in the comment section doesn't match the attachment's ID and I can't find a way to match them.

 

Here is the comment response, indicating that the body of has multiple parts: 

Comment.png

But the ID of the attachment is numeric, therefore if I search for the given ID or the occurence Key I can't find a matching file..

 

Here is the attachment response:

Attachment.pngHas anybody approached this scenario?


Thanks in advance for any help you can provide, 

5 answers

0 votes
Prakash Natarajan April 11, 2024

still facing this issue in 2024. Anyone know how to resolve this issue?

0 votes
Fabian Dittrich
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 12, 2024

Hi sergio.figueroa@escala24x7.com

we are desperately looking for a solution to pull comment attachments using the provided GUID, have you found any way to do this?

{"type"=>"mediaSingle",

      "content"=>[{"type"=>"media", "attrs"=>{"type"=>"file", "id"=>"5ac80cf3-82b7-4f59-a015-09dcbc3f18de", "collection"=>"", "width"=>2534, "height"=>266}}],

Any suggestion is highly appreciated.

Fabian

0 votes
Dinesh Korgaokar March 6, 2023

If you try to render JIRA comments the below URL is added to attachments in comments. using curl command u can download the file by generating below URL.

https://your.atlassian.net/secure/attachment/<attachment ID>/<attachment ID>_<filename>

pass username & password using CURL.

Thanks hope it helps

0 votes
Stacy Menigoz May 10, 2021

Did you figure anything out?  We are experiencing the same scenario. The only thing I can think for us to do is run a sub-process on the attachment end point if we see a type other than 'text'.

 

Let me know if you found a solution.

Thanks,

Stacy

sergio.figueroa@escala24x7.com May 10, 2021

Hi @Stacy Menigoz unfortunately no... The only solution we were able to come up with was to store the ID's of the attachments we already sent by Issue and when hook alerts of a new comment compare the existing ID's with the ones we already sent and then only consider the ones that don't match.


We know it's not an actual solution... but it was the best we could do with what we have!! 


If you and your team have a better idea, we would really appreciate it if you can share the concept with us!!!


Best of luck and hope our patch helps you somehow!!

0 votes
David Bakkers
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2021

Hello sergio.figueroa@escala24x7.com 

Can you clarify what you mean by 'pull the attachment'? The REST API can only provide metadata about the attachment, such as its size, location, ID, URL etc.

As per the documentation, the REST API cannot provide the actual data content of the attachment. IE, you can't extract the JPG picture's image via the REST API.

sergio.figueroa@escala24x7.com March 20, 2021

Hi @David Bakkers, actually you do if you interact with the "Attachment" endpoint (https://{domain}.atlassian.net/rest/api/3/attachment/{id}), but you need the actual numeric ID that you can find if you call the ".../issue/{key}" endpoint.

My problem is that although the comment indicates that has a media part (the file per se) it doesn't indicates the id of the file, rather than a GUID that I haven't been able to match with the ID therefore being unable to determine which attachment is part of the comment.

Thanks anyway for replying, I'll keep searching!!!

Prajesh Sortee August 22, 2022

Hi sergio.figueroa@escala24x7.com ,

Did you find a solution for pulling the attachment of the comment?

If Yes, Please Share.

Thanks!!

sergio.figueroa@escala24x7.com August 24, 2022

Hello @Prajesh Sortee , 

Unfortunately, he came up with a solution, but not a proper one... Right now, we are storing the IDs of the attachments that have been synced and when we detect a comment that has an attachment, we compare the list to detect which ones are new and send them.

I'm sorry I don't have a better answer for you, but we couldn't keep spending time to find a proper solution for the problem!

Prajesh Sortee August 24, 2022

Suggest an answer

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

Atlassian Community Events