Forums

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

Cannot add attachment in a comment an issue via API version-3

mohanraj_kandhasamy
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!
March 28, 2021

Hi and thank you for taking the time to read my question!

 

V3 endpoint:

rest/api/3/issue/{issueKeyID}/comment

V3 request body:

{
"body":{
"type":"doc",
"version":1,
"content":[
{
"type":"paragraph",
"content":[
{
"type":"text",
"text":"Paragraph Text"
}
]
},
{
"type":"mediaSingle",
"attrs":{
"layout":"align-start"
},
"content":[
{
"type":"media",
"attrs":{
"id":"9458e39e-ed47-4598-9a42-81a039283wda",
"type":"file",
"collection":"",
"width":595,
"height":595
}
}
]
}
]
}
}

 

Making a POST request to the above endpoint results in this,

{"errorMessages":[],"errors":{"comment":"Comment body is not valid!"}}

 

3 answers

0 votes
Gabriele Bracciali
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 6, 2022

Hello!
Someone have find a good way to do it?

0 votes
Bakul Banthia January 7, 2022

Hi,

 

I am also facing the same problem. Is there a solution fr this?

In order to add the attachment in the comment, I need to supply the attachment's UUID in the mediaGroup, but that UUID is not available in any API output.

I tried with the attachment ID, but then I get an error saying that attachment validation failed.

0 votes
Martin Bayer [MoroSystems, s.r.o.]
Community Champion
April 15, 2021

Hi @mohanraj_kandhasamy did you try to use something simple on the beginning? I can see quite nice example in the docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post

 

To be honest, I think you can't post attachments as part of the comment. You need to post attachment to Jira first and create link to it in the comment...

Check if the endpoint is working with simple body and we can work on it after that...

Mohamed Arfaoui
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!
January 14, 2022

Hello @Martin Bayer [MoroSystems, s.r.o.] 
is it possible now to post a comment with attachment ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events