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

Your Points Tracker
Challenges
Leaderboard
  • 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
Recognition
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?
Kudos
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

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

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
Community showcase
Published in Marketplace Apps & Integrations

Why everyone using Jira must be GDPR-compliant

Did you know that penalties up to 4 % of the yearly company turnover are possible in case of GDPR violations? GDPR regulations are currently mainly relevant for companies in the EU, but countries lik...

81 views 1 2
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