API Connector: Null Value Clearing Option Set Value

Good Morning! I am having an issue where I am sending a patch API Request using Connector to the Bubble Database, however on sending an empty/null value to an item that references an Option Set, it clears its value instead of leaving it as its original value?

The idea is that I am using one JSON-structured API for two purposes, one of which does not set the value of ‘Status’. I have tried using parenthesis, and also checking and un-checking ‘allow blank’, yet it still seems to blank the value.

When the JSON for the ‘Status’ element is removed from the API Patch, it leaves the value alone, so I feel the ‘Allow Blank’ is actually clearing the field, instead of ignoring ‘this line of JSON’ by sending a null request.

Physically writing null next to the JSON structure for that line also clears the ‘Status’ value.

Thanks for any advice you may be able to provide. I have has a really good hunt across the forum world, but cannot seem to find anything relating to this issue. :grinning:

Mapped Fields on API Initilisation

API Patch Settings:

Backend Workflow:

Bubble Server Log:

Data Structure:

This is expected behavior. If you want to not change the value, you will need to send your request without the status if empty.

Your payload in JSON connector should look like:

{
"CurrentAssignement":<currentassignment><text><time><status><code>
}

In your setting, you will put the whole line like

Status is empty:format as text(in format as text: leave yes empty, in no set : "status":status:formatted as json-safe

Don’t forget the comma at beginning. In my example, I’ve also set the time, code and text the same way because this was all related to status.

Thank you very much! Super star!!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.