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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

236 views 0 6
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