Updating a record via API
Options
Vlad B
Member ✭
I am having a bit of a noob issue and have not found a post on the topic. Maybe it is too simple, so please bare with me
I have a POST method for one of the tables. It is a profile table so it has a few fields there. I want all of them to be optional when updating meaning I can just send 3 o the fields, and only that information is updated.
With the default Edit Record, when I send the call with just 3 fields it updates those 3 but sets every other field to empty. I tried changing it to patch but didn't really work.
Also tried filters - added an is_null check and then added a get for the old value. But with this approach, the fields that do have new values do not get updated.
What is the easiest way to update just a few of the properties of a record without creating a call or function for each?
I have a POST method for one of the tables. It is a profile table so it has a few fields there. I want all of them to be optional when updating meaning I can just send 3 o the fields, and only that information is updated.
With the default Edit Record, when I send the call with just 3 fields it updates those 3 but sets every other field to empty. I tried changing it to patch but didn't really work.
Also tried filters - added an is_null check and then added a get for the old value. But with this approach, the fields that do have new values do not get updated.
What is the easiest way to update just a few of the properties of a record without creating a call or function for each?
Comments
-
Hey -
There are a couple methods, I'd recommend this first one as described in this tutorial to use conditional set filters:
Or you could go about the "long-hand" way with conditional statements:
-
Thanks!! This is exactly what I was looking for.
-
brilliant. loved the first method.
-
I don't see links to any tutorials!
-
I'm facing the same problem how did you fix it ?
-
Is this what you guys are trying to get done?
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback