API Connector passes "null" when empty

Hey everyone,

I am using the API connector to pass data from Bubble to Airtable. I have used the “find & replace” function within each field to ensure that non-JSON characters are escaped (included is an image of the setup - 1).

1

However, when the value to be passed is empty, Bubble ends up sending “null” which causes a problem at the Airtable end (included a screenshot of that - 2). How can I make Bubble pass empty when it is empty, instead of “null”?

2

I have removed the dummy values from the API connector page also, because Bubble otherwise ends up sending the dummy values. Included a screenshot of that too (3).

3

I’ve checked the forum and I see that others are facing this problem too and there’s no answer on the thread: Empty dynamic value as null?.

This is the final hurdle I need to solve to launch my app. Please help me with this!

Thank you :)!

You could use a JSON body instead of parameters, and do a {}

Thanks Nigel - I am not sure I understand that entirely. Even now it is a JSON body, just with the parameters to allow me to pass the value dynamically, isn’t it?

I have shared how I’ve defined one such parameter below. Would you mind telling me how I could rather send it across in the method you are suggesting?

{
"records": [
{
  "id": "<record-id>",
  "fields": {
		"Availability": <availibility>
}
}
]
}

Also, I assume that I’ll still be able to send the value of these fields through the workflows. But if the approach changes on that front please let me know.

A BIG thanks!

Hey @NigelG

Sorry to trouble, but would really love your guidance here. I would be able to wrap this app up over the weekend if you can push me in the right direction :slight_smile:

Will have a look today for you.

I suppose the obvious question is why you aren’t using the Bubble Airtable Plugin?

However, maybe put the whole field (including JSON) in a parameter.

image

Then set it to blank if your field is empty ?

image

image

Seems to work. Should be fixed on the Bubble end of course.

2 Likes

Sorry for the late reply, Nigel and a big thanks for the details!

I am not using the Bubble - Airtable plugin because I found it a bit tough to decrypt. The very first “RecordID” field just continuously kept giving me a data mismatch error. I actually have a column in my Bubble db with the exact Airtable record id - so that stumped me a bit.

So, that exploration ended before I could get about digging a bit. Let me know if you think that this was a bad decision.

About the API connector, I realised the problem was that I was only passing the output to the api connector and wrapping the quotes in the api connector page. In this case, it passes “null” as the output.

Instead, now I have wrapped the text in quotes in the workflow itself (instead of the api connector page). Now it passing an empty string instead of a “null”.

So, this change solved it for me.

6 Likes

Thanks for this truly straightforward solution!