How to add comment in Jira using rest api

Kirill Bezugly February 22, 2017

I work with JIRA 6.3.9. I need to add comment in issue. For making POST request i use program Postman. I have administrator account.
My post request https://88.208***/rest/api/2/issue/13138/comment
In Administration I indicate Type Basic Auth and Username, Password of administrator account
In field body i write:

{
"body": "My comment.",
"visibility": {
"type": "role",
"value": "Administrators"
}
}


Answer:

<html>
<head>
<title>Apache Tomcat/7.0.55 - Error report</title>
<style>
<!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}-->
</style>
</head>
<body>
<h1>HTTP Status 415 - Unsupported Media Type</h1>
<HR size="1" noshade="noshade">
<p>
<b>type</b> Status report
</p>
<p>
<b>message</b>
<u>Unsupported Media Type</u>
</p>
<p>
<b>description</b>
<u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</u>
</p>
<HR size="1" noshade="noshade">
<h3>Apache Tomcat/7.0.55</h3>
</body>
</html>


I also tried like that:
POST https://88.208***/rest/api/2/issue/13138
in body

{
"body": "My comment." 
}


or

{
"update": {
"comment": [
{
"add": {
"body": "It is time to finish this task"
}
}
]
}
}


Error is the same.
Atlassian documentation says about request parameter expand, but i don't know how to use it

I don't know what to do. Help, please

1 answer

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2017

Do a POST to https://88.208***/rest/api/2/issue/13138/comment with the following JSON object:

{
"body": "It is time to finish this task"
}

Let us know how that goes!

Kirill Bezugly February 23, 2017

It doesn't work(

Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 24, 2017

What error are you getting now?

Balachandran Gangatharan May 11, 2018

It worked for me. Thank you Jobin.

CodeElan June 29, 2020

Worked for me too.... Thanks Jobin...

alok.agrawal@das.ohio.gov February 4, 2021

is there any way to add comments while creating an issue ?

Héctor García September 28, 2021

thanks it worked for me 

Suggest an answer

Log in or Sign up to answer