Forums

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

Can't update issuepicker via REST API

sorrat
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 1, 2014

It is possible to set a new value if field is null, but it is not possible to change an existing value, always got 500 server error.

This error in JIRA logs:

/rest/api/2/issue/12300 
[common.error.jersey.ThrowableExceptionMapper] Uncaught exception thrown by REST service
javax.ws.rs.WebApplicationException
...
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String

I tried all values: null, [], "" - none of them works.

curl -D- \
    -u user:password -X PUT \
    --data '{ "update": {"customfield_12100": [{"set": ""}] }}' \
    -H "Content-Type: application/json" \
    http://localhost:8080/rest/api/2/issue/12300

1 answer

0 votes
Nic Brough -Adaptavist-
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.
June 1, 2014

You'll need to delve into the behaviour of the issue picker field type. At a glance, it's expecting a string, not an array, so you'll need to construct a string of the type it is expecting from your array.

sorrat
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 1, 2014

If field is blank (null), you are right, I can set field's value by

'{ "update": {"customfield_12100": [{"set": "Some-valid-issue-key"}] }}'

But after (when field is not blank) this gives me 500 error.

'{ "update": {"customfield_12100": [{"set": "Another-valid-issue-key"}] }}'

So I sad, I tried all types (null, empty array, array with values, string) - all give me 500 error.

anatole farci August 3, 2016

@Fedor Stepanov - did you figure a workaround for this? I have the same issue updating a Kepler custom issue and the CREATE/INSERT works but the UPDATE gives me the error that you were getting.   The JIRA CLI works but not the REST API.

We tried to set it to NULL (tried to make it go away) so that we can insert a new value but the update to NULL is giving us the same error.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events