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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,290
Community Members
 
Community Events
184
Community Groups

Cloud Rest Api not consuming post request body

Edited

Hi, 
trying to notify users via POST method: '/rest/api/3/issue/' + issueId + '/notify' in ScriptRunner, this error appears:

{"errorMessages":["Unrecognized field \"delegate\" (Class com.atlassian.jira.issue.fields.rest.json.beans.GroupJsonBean), not marked as ignorable\n at [Source: com.atlassian.plugin.connect.plugin.auth.scope.InputConsumingHttpServletRequest$1@1e68716f; line: 1, column: 213] (through reference chain: com.atlassian.jira.issue.fields.rest.json.beans.NotificationJsonBean[\"to\"]->com.atlassian.jira.issue.fields.rest.json.beans.ToJsonBean[\"groups\"]->com.atlassian.jira.issue.fields.rest.json.beans.GroupJsonBean[\"delegate\"])"]}

 

 Post method used:

def result = post('/rest/api/3/issue/' + "TEST-1" + '/notify')
.header('Content-Type', 'application/json')
.header('Authentication', 'Basic user:password')

.body(
[
htmlBody: "The <strong>latest</strong> test results for this ticket are now available. Blahblahblah",
subject: "Blah",
textBody: "TextBody blahblah",
to: [
voters: false,
watchers: false,
groups: [
{name: 'test-notify'
}
],
assignee: false,
reporter: false,

]
])
.asString().body

 
The issue is with the "groups", it seems ScriptRunner expects some 'delegate' field, which is not in API documentation. Once groups are removed, code works correctly

How can I send notifications to Groups?
Thank you

1 answer

1 accepted

0 votes
Answer accepted
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 28, 2020 • edited

Hi Adam,

I believe that the error is coming from the fact that the syntax in your rest call is invalid.

I can confirm that we have an example of how to call the notify API with ScriptRunner for Jira Cloud inside of the documentation page located here and I would advise you refactor your script to use the syntax shown in this example. 

I have tested the syntax shown in the documentation page above and can confirm this works and sends a notification as expected.

I hope this information helps.

Regards,

Kristian

Hi Kristian,
you're right, there should have been double square brackets around 'groups' in my code ... 

Thank you

BR / Adam

Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 29, 2020

Hi Adam,

Thank you for confirming that our response has helped you to resolve your issue.

Regards,

Kristian

Like Adam Hraban likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events