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,554,975
Community Members
 
Community Events
184
Community Groups

I am getting an error when using Script Listeners to make an api call

Edited

I am getting an error when making an api call to update the priority of an issue using a script listener. Could someone tell me how I can resolve these errors?

Here is my api call:
put("/rest/api/2/issue/${issue.key}")
.header("Content-Type", "application/json")
.body(
fields: {
priority: {id:"1"}
}
)
.asString()

Here is the error response:
body: {"errorMessages":[],"errors":{"delegate":"Field 'delegate' cannot be set. It is not on the appropriate screen, or unknown.","owner":"Field 'owner' cannot be set. It is not on the appropriate screen, or unknown.","maximumNumberOfParameters":"Field 'maximumNumberOfParameters' cannot be set. It is not on the appropriate screen, or unknown.","parameterTypes":"Field 'parameterTypes' cannot be set. It is not on the appropriate screen, or unknown.","resolveStrategy":"Field 'resolveStrategy' cannot be set. It is not on the appropriate screen, or unknown.","thisObject":"Field 'thisObject' cannot be set. It is not on the appropriate screen, or unknown.","directive":"Field 'directive' cannot be set. It is not on the appropriate screen, or unknown."}}

1 answer

1 accepted

2 votes
Answer accepted

I have resolved the api errors by substituting curly brackets in the request body for square brackets. The docs for the request body suggest curly brackets but it seems only square brackets work. I hope this helps someone else.

put("/rest/api/2/issue/${issue.key}")
.header("Content-Type", "application/json")
.body([
fields: [
priority: [ name: NewPriority ]
]
])
.asString()

Ken McClean
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.
May 04, 2023

Thank you! This is the only result when you Google the issue, but fortunately it works.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events