This question is in reference to Atlassian Developer Documentation: Updating an Issue via the JIRA REST APIs
Using the REST API, I can't seem to set the value of a custom field to the value which is displayed as "None" in the web UI.
I've seen https://answers.atlassian.com/questions/131241 , but that does not specifically relate to the REST API. It says to send a null value, but doing:
{ "update" : { "customfield_11139" : [ { "set" : { "value" : null } } ] } }
gives the error:
400 Bad Request
{"errorMessages":[],"errors":{"customfield_11139":"Could not find valid 'id' or 'value' in the Parent Option object."}}
Trying:
{ "update" : { "customfield_11139" : [ { "set" : { "value" : "None" } } ] } }
gives:
400 Bad Request
{"errorMessages":[],"errors":{"customfield_11139":"Option id 'null' is not valid"}}
Exactly the same error is thrown if I send the empty string as the value.
Setting the value to one of the other legal defined values works fine. BTW, this is using JIRA 7.0.10.
Does anyone know how I do this?
Community moderators have prevented the ability to post new answers.
I've just created this article on how to set a Select List to None
{ "fields": { "customfield_11139": null } }
Thank you for this. However, it is inconvenient for my code to restructure the message entirely if the value is "null". At the moment, as you see, I am using:
"update"
: {
"customfield_11139"
: [
{
"set"
: {
"value"
: <value>
}
}
]
}
Is there a way to do this within that structure?
If not, can I change it to always use:
"fields": { "customfield_11139": null } }
? Will that work to set any value, not just null? What is the difference between these different methods of setting the field values?
Gerv
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just tested with the following and it works as well
{ "update" : { "customfield_10200" : [ { "set" : null } ] } }
The original one using "fields" works with any values but I only tested for Select List. You can check out the article where I actually used it to set a value. I'm not sure if it works with other types of custom field.
However I'm not sure about the differences between them though.
Yit Wei
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I seem to remember
"value" : ""
being worth a try
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"Exactly the same error is thrown if I send the empty string as the value."
--> I tried that :-|
Gerv
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.