How to implement the PATCH Method the right way?
![devben](https://us.v-cdn.net/6037124/uploads/userpics/XX4MFWKNOVFS/nRGEWZK7GUGE5.png)
In Xano, the PATCH method overwrites the entire object by default. This is not how I imagine it. Normally PATCH should be used for partial changes and PUT should overwrite the object.
So now I am looking for a filter for my fields to overwrite the values only if the keys occur in the request.
I have to say that I imagined this would be easier.
This menu is so badly described that it is not at all clear what the filter is applied to.
How can I apply the filter so that a key value of the request is only written to the appropriate database field if it exists and only if it is not empty or not null or ""?
Best Answers
-
Hi @devben,
I believe this video will help with what you are trying to accomplish.
-
From a bit more technical point of view, you can also process like this :
it just requires that you know, from your frontend, how to build JSON dynamically…
Answers
-
@Louis Machado - CSA I don't know why but it works.
My Endpoint has the URL Parameter of the ID of the Xano record so I know which one it is why do I need to first GET the records in order to update them? How does this work? -
@Guillaume Maison That's exactly how I imagine it👌Thanks a lot! 🙂
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