Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

add Comment API error Invalid request payload. Refer to the REST API documentation and try again.

Edited
const bodyData = {
body: {
content: [
{
content: [
{
text: "contentlfjdlfkjsf",
type: "text",
},
],
type: "paragraph",
},
],
type: "doc",
version: 1,
},
visibility: {
identifier: "Administrators",
type: "role",
value: "Administrators",
},
};

above is my bodyData.

I sent through below 

const url = `https://api.atlassian.com/ex/jira/${cloudId}/rest/api/3/issue/${issueId}/comment`;
fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${accessToken}`,
Accept: "application/json",
"Content-Type": "application/json",
},
body: bodyData,
})
.then((response) => {
return response.json();
})
.then((data) => {
resolve(data);
})
.catch((err) => {
logger.error(err);
reject(err);
});


I did this but I get an error message:
"error Invalid request payload. Refer to the REST API documentation and try again."


what am I doing wrong...


so I did JSON.Stringify(bodyData)

then I git a new error message: 'The body parameters 'value' and 'identifier' are mutually exclusive.'


.. please help

1 answer

1 accepted

0 votes
Answer accepted

I deleted "visibility" part and it returns a success response but I don't see the actual comment added to my issue... 

So I figured it out that I needed to add visbility and simply add members to the project Role to view comments.
hope my answer helps others who struggle with the same issue 

Bill Sheboy
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.
Oct 06, 2023

Hi @Jenni 

As you have solved this, please mark your own solution as "answered" to help others in the community.  Thanks!

Kind regards,
Bill

Suggest an answer

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

Atlassian Community Events