Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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 Apps & Integrations

Send an Email or Publish to Confluence - What should you do with your release notes?

Background When you hear the words ‘Release notes’, almost always you think of an unsolicited email from a software vendor. But I am here to tell you that from our data, sending release notes via E...

105 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