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

400 - Bad Request upon issue edit with ScriptRunner

Currently facing the following problem; I am trying to update an issue through ScriptRunner with the following script:

def response2 = put('/rest/api/3/issue/' + issueID)
.queryString("overrideScreenSecurity", Boolean.TRUE)
.queryString("overrideEditableFlag", Boolean.TRUE)
.header('Content-Type', 'application/json')
.header('Authorization', <token>)
.body([
fields: [
summary: [
set: "<string>"
]
]
])
.asString()

 It returns a 400 - Bad Request error (HTML formatted with no additional details). However, the exact same request in Postman results in no errors and the content is updated accordingly (Postman code below).

 

HttpResponse<String> response = Unirest.put("<baseurl>/rest/api/3/issue/ISD-1")
.header("content-type", "application/json")
.header("authorization", <token>)
.header("cache-control", "no-cache")
.header("postman-token", "fa61e5b1-df1e-5855-eafb-101ce7cbf7b4")
.body("{\"update\": {\"summary\": [{\"set\": \"<string>\"}], \"customfield_10038\": [{\"set\": \"<string>\"}]}}")
.asString();

 

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.
Dec 06, 2019

Hi, a.borger,

Thank you for your question.

I can confirm that the reason that you are getting the error above is due to the fact that the structure of your rest call is not valid for ScriptRunner for Jira Cloud.

I can confirm that we have an example script which shows how to Update an Issue inside of the documentation page located here.

You will be able to take this example this script and run this on the Script Console in order to test updating an issue and to figure out the correct syntax which you require.

If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.

Regards,

Kristian

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events