Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I update the options in a Select List (Single Choice) field?

Chance Douglass
Contributor
February 15, 2024

I have followed the documentation at https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-options/#api-rest-api-3-field-fieldid-context-contextid-option-post

But constantly get this error message:

{
"errorMessages": [
"The id has to be provided.",
"The id has to be provided."
],
"errors": {}
}

 

The documentation does not say to add an id, and how can I provide an id for an option I am trying to create, and therefore does not have an id yet?

1 answer

1 accepted

1 vote
Answer accepted
Bill Sheboy
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.
February 15, 2024

Hi @Chance Douglass -- Welcome to the Atlassian Community!

I have not tried that one, but I wonder what your request's body options look like. 

The example in the documentation seems to be an update to add more options.  And the existing options are also passed, including their current id values.

Kind regards,
Bill

Chance Douglass
Contributor
February 16, 2024

Bill, thank you, nice to e-meet you.

Below is the payload portion of the script with current values.  When I include the current value I get the same message. If I change to 'optionId' instead of "id" on the current value I get incorrect payload.

payload = json.dumps({
"options": [
{
"disabled": false,
"id": "14617",
"value": "Option 1"
},
{
"disabled": false,
"value": "Option 2"
},
{
"disabled": false,
"value": "Option 3"
}
]
})


This is a field created for testing and so 'Option 1', etc are the actual values and not stand-ins

 

Bill Sheboy
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.
February 16, 2024

Looking at the documentation and this post in the developer community: https://community.developer.atlassian.com/t/how-to-add-an-option-to-a-select-list-using-rest-api-in-python/70734

  • optionId is used for cascading fields; use id for simple select fields
  • the id values are included only when updating the value of existing options; otherwise only add the new ones
  • the dev community comments suggest a distinction for PUT versus POST, where PUT only allows updates to existing options and not adding new ones

 

Chance Douglass
Contributor
February 16, 2024

Bill,

Thank you. Removing the existing options, and only including the new options with a POST worked. Thank you again

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events