Forums

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

Adding attachments to comments via the API is not working properly

Bernhard Mostrey
February 10, 2025

We are trying to do a sync between Topdesk and Jira. So far so good.

But when we try to add a comment to Jira with an attachment included, the attachment is only visible in the backend. When the customer checks the issue in the Portal they get a Preview Unavailable and cannot open the attachment.

This is the payload we are using for the comment api.

 

{ "body": { "type": "doc", "version": 1, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Here is the attached image:" } ] }, { "type": "mediaSingle", "attrs": { "layout": "center" }, "content": [ { "type": "media", "attrs": { "type": "external", "url": "https://domain.atlassian.net/secure/attachment/ID/FILENAME.png" } } ] } ] } }

1 answer

0 votes
Tuncay Senturk _Snapbytes_
Community Champion
March 25, 2026

Hi @Bernhard Mostrey 

I am not sure if you've already found the answer to this.

The json tells that the attachment is referenced incorrectly (type: external) in the comment body. This does not work properly in the JSM portal.

I do not know which/how you used REST API below are the correct API endpoints

for uploading the attachment 

POST /rest/api/3/issue/{issueIdOrKey}/attachments

for adding comment

POST /rest/api/3/issue/{issueIdOrKey}/comment

If you need inline images the json would be like 

"type": "media",
  "attrs": {
   "type": "file",
   "id": "<mediaId>"
}

 

Suggest an answer

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

Atlassian Community Events