Cannot set enum custom field back to empty using REST API

I have a custom field set up in my projects (named “Requires QA review” with two values, “Yes”, “No” and set as “can be empty”.   In the UI, I can set a value BUT I can also set the value back to empty (when it displays “no requires qa review”).  

I would like to be able to do the same thing using the REST API but I cannot find any way to do it.  When I view the enum bundle value when the value is cleared, it is reported as null.  I've tried sending the null value but get a message saying null is not a valid value.  I've tried sending the “no requires qa review” value but get the same response.

Is there a way to set the custom field value back to empty through the REST API?

0
3 comments
Official comment

Hi Nick Hallwood,

Sending a null value is the correct approach to clearing field values. For example, if you usually post this to api/issues/{issueKey} to change the "Requires QA review" field value to “Yes”:

{
    "fields": [
        {
            "$type": "SingleEnumIssueCustomField",
            "id": "{fieldId}",
            "value": {
                "name": "Yes"
            }
        }
    ]
}

…then sending this should set an empty value:

{
    "fields": [
        {
            "$type": "SingleEnumIssueCustomField",
            "id": "{fieldId}",
            "value": null
        }
    ]
}

Can you please share the endpoint you use, the exact body you send, and the error you get?

Hi Julia,

Thanks for your quick response!  Your explanation of how to send the null value has solved the issue for me.  I had been using the following in the body 

            "value": {
                "name": "null
			}

instead of just “Value”: null

Thanks.  Nick.
 

0

Thanks for the update! I'm glad I could help 😊

0

Please sign in to leave a comment.