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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to attach a text file to a comment to jira ticket using REST API?

Hi, I would like to attach a text file to a comment in Jira issue via REST API.
I see that it is possible over web interface, so I assume it is also possible via REST API.

1 answer

0 votes
Andy Heinzer Atlassian Team Nov 12, 2019

Hi @dmytrob 

I understand that you are looking for a way to attach a text file to a comment in Jira using the REST API.  This can be done, but it technically requires two different REST API POST commands to two different REST endpoints to make this work.

In order for you to be able to link to an attachment in the comments or description of a Jira issue, that attachment has an expectation that it will have already been uploaded to that specific Jira issue.  Once that is true, you can then reference that attachment via the wiki-markup of the comment itself.

Check out the Jira Server REST API reference for POST /rest/api/2/issue/{issueIdOrKey}/attachments.  That explains how you can add an attachment to a Jira issue first.  Once that command has completed, you can then add a comment using the endpoint POST /rest/api/2/issue/{issueIdOrKey}/comment.  If the filename that is uploaded to that Jira issue is called example.txt then the body of that comment should contain some wiki-markup like this:

Here is a link to the [^example.txt] file.

That should then permit your comment to have a link directly to that attachment on that issue.

Let me know if you have any questions about this.



Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you