How to save values to a multiselect field using the rest API

Ken O_Brien November 4, 2020

I am attempting to set the values for a Jira object (type: array, items: option, customfieldtypes:multicheckboxes) using the Jira REST API, as specified in the documentation but it does not work giving me a variety of errors from "Bad Request" to "Not Authorized" but the problem seem to be that the body of the web request is malformed. 

According to the documentation the format should be: "customfield_11201": [{"value": "Disclosure"}]

where "Disclosure" is an allowable value.  This is throwing an error.

2 answers

1 accepted

2 votes
Answer accepted
Prince Nyeche
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.
November 5, 2020

Hi @Ken O_Brien 

I believe you need to add the field context as a key in a dict to be able to use it. example of payload

{

"fields":

{ "customfield_11201": [{"value": "Disclosure"}]

   }

}
Ken O_Brien November 6, 2020

Hi Prince Nyeche.  Thanks for the quick response that code will work for a single value, but when I try saving a comma separated list (multiple values) it throws an error?

Prince Nyeche
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.
November 6, 2020

Hi @Ken O_Brien 

What example of comma separated list are you using? i would assume you will use it as below for multiple values

{

"fields":

{ "customfield_11201": [{"value": "Disclosure"},{"value": "SecondValue"},{"value": "ThirdValue"}]

   }

}
Like Marwan Al Jeburi likes this
Ken O_Brien November 9, 2020

Yep, 

It is working now.  It was working with only one but now multiple values are saving.  I must have just had a slight problem with the formatting.  

One thing I did notice.  When using this data type it's seems to work best when you send it by itself in a the web request not as part of a comma separated list with a bunch of other custom fields.

 

 

Thanks for all your help!

0 votes
Fernando Simões December 19, 2022

Hi.
i have the same problem, but the solution given by @Prince Nyeche only the first checkbox is updating.

{

"fields":

"customfield_13304": [{"value""Yes"},{"value""Yes"}]

   }

}


Any thoughts ?


Devendar Gangapuram
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.
January 5, 2023

Hi,

 

We have to to save values to a Single select field using the rest API , could you please let me know how to use this code?

 

we have tried in lot of ways but no luck.

 

This custom filed id syntax should be used with update method or any othe method, please confirm.

 

issue.update({"fields":{"customfield_10903": [{"value": "Disclosure"}]}}) --- ?  // this is the code we tried but didn't work.

 

Please assist me on this issue asap.

 

advance thank you,

Dev G

Suggest an answer

Log in or Sign up to answer