Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

Recognition

  • Give kudos
  • My kudos

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Value isn't sent in REST call using ScriptRunner Edited

If I run the following code in ScriptRunner's script console, I get an error back from the response that says I didn't set the value for the 'value' field.

def result = put("/rest/api/3/customField/12345/option")
.header('Accept', 'application/json')
.header('Content-Type', 'application/json')
.body([
options:[
[
value: 'A_VALUE'
]
]
])
.asString()

if (result.status == 201) {
return "Success"
} else {
return "${result.status}: ${result.body}"
}

The error that I get is:

400: {"errorMessages":["Every option is required to have a non empty field 'value'."],"errors":{}}

It seems to me like the value field is NOT empty.

Note that I can run the request in Postman without any errors.

1 answer

Hi Mikey,

Not Sure if you got this resolved or not, but I'm posting for those like me who Google upon this post. 

The issue as I can tell is that the "options" parent is looking for both "newValue" and "value" even if not updating the parent value.

 

{
"options": [
{
"newValue": "ParentName",
"value": "ParentName",
"cascadingOptions": [
{
"newValue": "NewChildValue",
"value": "OldChildValue"
}
]
}
]
}

 Which is not how I would interpret the documentation.JiraCapture.PNG

Hi, Casey. Thanks for posting. I never resolved this using ScriptRunner, so I just moved forward using Postman and an API token. The body of the request looked like this:

{
"options": [
{"value" : "Alpha"},
{"value" : "Bravo"},
{"value" : "Charlie"}
]
}

 Note that it looks like our use cases might have been different as it looks like you were changing values and I was creating new options values.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Marketplace Apps & Integrations

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

284 views 2 5
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