Can't update issuepicker via REST API

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 vote

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.

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.

@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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

136 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you