PATCHing in Xano, how does it really work?

Hi,

after i switched to Xano from Supabase, i am confused with the PATCH query.

Do i really need to define for each request what i want to change in the Endpoint/Table?

E.g. i want to change only the username, so from my experience i have to make a separate Endpoint only for changing the username.

Otherwise, if not, it will fill the other columns with “ “, basically giving an empty entry.

Is there any other way to have it in one Endpoint?

Not a XANO expert, but I believe if you dont include a field in the request it wont be changed

I did actually, i even make the fields not visible.

But the not visible fields are overriding my other fields with empty fields “”.

Basically my own workaround is to create new endpoints with the specific fiellds, which is weird. It can not be like that…

I will recheck again tomorrow to make sure.

@IKR in Xano this is well known issue you have to deal with manually. There was aa discussion on the forum already: Unwanted Xano data over-write from weweb workflow

Thanks @Dominic didnt knew that one.
I was really hoping to do something wrong, crazy.
How they can create that garbage.

Hi @IKR !

What you can do to avoid creating multiple endpoints is to put all the data in a variable and when using the endpoint, if the input is empty, it takes the data from that variable. It’s like a copy and paste the same value. I know it’s not ideal, but it can speed up your creation.

Best Regards,

Hi and thanks @felipegranado
Its something i do at the moment, basically filling the “empty” fields with existing data that will not change. In some cases still need to create some new endpoints, but yeah it is like it is… :slight_smile:

1 Like

Hi @IKR you can use a POST and hide the iputs you don’t want to update

Here is how you can do what you want. You just set a first_notempty filter in Xano, its super easy to do, only takes a minute and you won’t have to create multiple endpoints or pass through all of the data.

1 Like

@mark great tips ! Thank you very much :clap:

@mark thanks, its what @Dominic said.
I will check that solution definetly out.

@mark @IKR you should use first_notnull filter in Xano. When you use first_notempty you will not be able to clear the data. When dealing with nullable inputs you have the following:
null (data not passed) → not changed
empty ( “” passed) → erased
not_empty → change the data.

When yo use first_notempty passing empty string will be bypassed by the filter and data will remain unchanged. In such a case you do not have a way to erase the data from the db column.

2 Likes

So this video is may be the best way :

@Dominic

It works like a charm, and you are right.
The order makes it. :+1: