Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Jira Cloud ScriptRunner Post Function (arbitrary script) fails when calling REST API with POST

I created a script to be run as ScriptRunner Add-On User (which I understand auto creates authentication). I tried my own function but when this failed tried the example for Notify on Priority Change. Below I have replaced the real issue ID and email for confidentiality. The real issue ID exists and the email address I used is my normal work email address (cloud based with SSO (Single Sign On)).

Both fail with

2021-05-04 16:43:12.586 INFO - Serializing object into 'interface java.util.List'
2021-05-04 16:43:12.639 INFO - GET /rest/api/2/field asObject Request Duration: 554ms
2021-05-04 16:43:12.818 INFO - Sending email notification for issue <my issue ID>
2021-05-04 16:43:13.024 INFO - POST /rest/api/2/issue/90367/notify asString Request Duration: 203ms
2021-05-04 16:43:13.025 WARN - POST request to /rest/api/2/issue/90367/notify returned an error code: status: 400 - Bad Request
body: {"errorMessages":["Can not deserialize instance of out of START_ARRAY token\n at [Source: com.atlassian.plugin.connect.plugin.auth.scope.InputConsumingHttpServletRequest$1@541f4926; line: 1, column: 350] (through reference chain:[\"to\"]->[\"users\"])"]}
2021-05-04 16:43:13.026 INFO - Serializing object into 'interface java.util.Map'
2021-05-04 16:43:13.026 INFO - Run script completed

The script is

def resp = post("/rest/api/2/issue/<my issue ID>/notify")
.header("Content-Type", "application/json")
subject: 'Mail title',
textBody: "Body",
htmlBody: "<p>Body</p>",
to: [
users: [[
name: "",
active: true
//groups: [[
// name: 'some group'

1 answer

0 votes
Thomas Deiler Community Leader May 06, 2021

Dear @Wayne ,

I just copy & pasted your 'body' string into my editor. It seems that you are using the wrong brackets. Use '{' instead of '[' and the elements are not quoted. Have a look at the sample from Atlassian.

BtW: You do not use the latest version "3" of the API.

So long


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

314 views 9 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you