Link or Reference an Attachment in a Comment

I am trying to make a comment on an issue through the Rest API that references or links to an attachment inside that issue. I have already successfully attached a PDF file to the issue and now would like to reference that attachment in a comment using the API so that the Service Desk Customer can access the PDF.

Per the API Documentation on Add Comment the body needs to be:

The comment text in Atlassian Document Format.

Looking at the Document Format the only option I see is creating a link to the attachment. But when I use the direct link to the attachment the customer doesn’t have access to that link. Is there a different way of doing this?


1 Like

I have done some testing and checking of what happens when a comment is made with a reference to the attachment within the UI and it looks like the link to the document is:


and the link from the comment created through the API is


They are really close, but when looking at the Comments through the API I get this:




Another interesting thing is that after I made the comment in the UI and referenced the same attachment, then both links work in either comment. Before that I received a 403 Unauthorized error when clicking the link from the comment created by the API.

I figured out how to do this. Instead of using the Jira API use the Jira Service Desk API. Under request, there is a Create Attachment function that allows you to create an attachment to the issue and then leave a comment for the customer referencing that attachment.

This worked well and I was able to attach a PDF to the issue and then leave a comment for the customer about that PDF.

1 Like