I am trying to update comment in my created issue. here i am facing 400 issue.
response:
ERROR 2024-08-22T12:59:24.513Z c507f70b-94d8-4bed-b9ae-d926d66cd1a7 Failed to add comment, status code: 400 response: {"errorMessages":[],"errors":{"comment":"Comment body can not be empty!"}}.
can you share your thoughts if anything i have mentioned wrong or missed anything
here is my sample request
try {
const response = await api.asApp().requestJira(route`/rest/api/3/issue/${event.issue.id}/comment`, {
method: 'POST',
body: JSON.stringify({
comment:{
body: "test comment"
}}),
headers: {
'Content-Type': 'application/json'
}
});
const responseBody = await response.text(); // Get raw text of response body
console.log('Raw response body:', responseBody);
if (response.ok) {
const data = JSON.parse(responseBody);
console.log('Comment successfully added:', data);
} else {
console.error('Failed to add comment, status code:', response.status, 'response:', responseBody);
}
} catch (error) {
console.error('Error adding comment:', error);
}