今日已更新 38 条资讯 | 累计 21257 条内容
关于我们

how to handle patch requests

/u/farzad_meow 2026年05月31日 08:09 4 次阅读 来源:Reddit r/webdev

so here is a problem i am trying to solve: context: restful or restlike api design partial update of entity through patch request. for this example let’s say client model. the problem is that different fields can be updated but result in different business logics to be triggered. for example change to client.name is a simple update but client.status can result in an email to go to users about the client being offboarded. or changes to client.ownerId require extra validation and verification of the assigned user. or changes to client.logo_url and client.website must happen together. what is the most ideal way to code it where one path can trigger different logics depending on body schema? I want an approach that is simple to work on many routes to develop business logic. AND, simple enough for others to read and debug as needed. please assume I am using a flexible framework that top engineers will implement whatever I ask them, so I am not limited to a given framework or a solution that exists. It can be an approach that does not exist but you hope it did. submitted by /u/farzad_meow [link] [留言]

本文内容来源于互联网,版权归原作者所有
查看原文