How to Properly Utilize PATCH
I was trying to configure PATCH to update information on a User database. I am currently using this with Draftbit.
My issue is that I am unsure how to specify that a user can only update their information both in the backend and in the front end.
How can i make this work?
Best Answer
-
Hi,
on the Xano side you can check for example with precondition that user you want to edit is the user trying to edit and throw an error otherwise. If this endoint require authentication and it seems that it should you can use user_id provided by it. You can find it in auth tab as "id", this is the id of the user who is making the request.
Answers
-
I see. Where would I go specifically to set up the error message?
-
In function stack in untility functions you have a function called precondition. You need to set the condition that need to be met to pass through that function if the condition is not met it will trow the error that you can specify.
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