Forums

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

Unable to get comment attachments from Rest API

Artis Inc
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!
September 11, 2020

Hi,

   I have a scenario like when a comment with attachment is created in Jira I need to add a comment with that attachment in 3rd party application. In this process when a comment is created with an attachment in Jira I'm getting attachment details in the comment body itself. How I can get separate details of attachments when added in a comment.

 

Thanks.

1 answer

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 14, 2020

Hi,

I see that you are looking to use the REST API in order to determine when an attachment was added in a comment.  Technically this is not something that I expect the REST API to be able to tell you (at least not in a single call). 

The main reason is that attachments in Jira are bound to the specific issue in question, and not directly to the comment that sits under that issue.  So while, yes you can refer to an attachment in a comment, in order to do so, technically that attachment has to exist on the Jira issue first and that attachment is only use a reference link such as !filename.jpg|thumbnail! or alike.  The web interface that end users will use tries to make this as seamless as possible, letting users attach that file in the comment text editor directly.

However using the REST API within Jira to pull back comments, does not tell us specifically if that file was on the issue before the comment, or was added when the comment was posted.   Only a careful examination of the attachment created time, can tell us when it was added to the issue.  Perhaps using the endpoint of GET /rest/api/3/attachment/{id} could at least return the metadata about that attachment (not the attachment itself).  From there you could then compare to see if perhaps you can match up the time a comment was made.  I know this seems clunky, but I don't believe there is a single REST API call you can make in order to get back exactly what you have asked for here.

Does this help?  If not, please let me know about what you are trying to do here, perhaps if I can better understand I can offer a different work-around.

Andy

Dragoslav _G_
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!
December 3, 2023

Suggest an answer

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

Atlassian Community Events