Hi,
I've got a problem trying to send a notification to the reporter of a issue or a defined user using Adaptavist Scriptrunner Escalation Service and and JIRA Clourd REST API v2 /rest/api/2/issue/${issue.key}/notify.
I created a script two weeks ago and it worked like expected and sends mails. But for some reason since last week (nothing has changed in the script) I receive an error when I run this script. Here is what it looks like:
def resp = post("/rest/api/2/issue/${issue.key}/notify")
.header("Content-Type", "application/json")
.body([
subject: 'Done Issue reminder',
textBody: "This issue was set to status \"Done\" two days ago and will be closed automatically tomorrow!",
htmlBody: "<p>This issue was set to status \"Done\" two days ago and will be closed automatically tomorrow!</p>",
to: [
reporter: true
]
])
.asString()
This is was the log says:
POST request to /rest/api/2/issue/ISSUEKEY/notify returned an error code: status: 400 - Bad Request body: {"errorMessages":["No recipients were defined for notification."],"errors":{}}
I also tried to define the user directly with:
users: [[
name: "myusername",
active: true
]]
but got the same error.
Is someone experiencing the same problems or was there something changed for Scriptrunner?
Greetings
Hi Nico,
Thank your question.
I can confirm that the reason that you cannot notify yourself is due to a limitation with the notify rest API which specifies that users are not allowed to notify their own user using the rest API.
As for your error on they syntax I would advise using the syntax shown in the documentation example located here under the resp post request as this shows the correct structure that you should use to make a post to the notify api.
Regards,
Kristian
Hi Kristian,
thanks. This really was caused by setting my profile to not notify me about my own changes.
Greetings
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.