How to get Jira Issue Comment attachment URL

Board Genius April 18, 2022

I have a comment on an Issue which has an image attached to the comment. I cannot find a way to get the URL of the image or to download the contents of the image. The comment API returns a JSON object describing the different sections of the comment. The section which holds the image attachment is described like this:

{
'type': 'media',
'attrs': {
'width': 924,
'type': 'file',
'id': '3b8c8cc8-0a4d-492a-8e1c-18214dc2afee',
'collection': '',
'height': 504
}
}

It seems the ID given here has no use. This is not the ID that is expected by the comment API. The comment API expects an integer for ID.

At the issue level, the API will return fields -> attachment -> list of attachments. This list will include the attachment for the image that is used in the comment. However, there is no information to know which attachment is for which comment image. This is because the IDs in the 'attachment' array are integers (e.g. 10010) and not the GUID-like ID that is given from the comment API. 

Here is the same image from above as conveyed in the issue->field->attachment, with no way to know they are the same image or attachment:

'content': 'https://api.atlassian.com/ex/jira/000/..../rest/api/3/attachment/content/10010',
'created': '2022-04-18T19:48:49.244-0400',
'filename': 'Screen Shot 2022-04-16 at 2.37.09 PM.png',
'id': '10010',
'mimeType': 'image/png',
'self': 'https://api.atlassian.com/ex/jira/000/..../rest/api/3/attachment/10010',
'size': 96722,
'thumbnail': 'https://api.atlassian.com/ex/jira/000/..../rest/api/3/attachment/thumbnail/10010'},

 

2 answers

1 accepted

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 18, 2022

From the Comment API, does the "content" attribute include text for a link to the attachment?

Board Genius April 25, 2022

No

Like Milánovics Péter likes this

Suggest an answer

Log in or Sign up to answer