4 ms·
We don't use PATCH but use a PUT for partial objects. We have validator code at every endpoint and we validate both creates and updates. When a PUT comes in, th
by polishdude20 5y ago
We don't use PATCH but use a PUT for partial objects. We have validator code at every endpoint and we validate both creates and updates. When a PUT comes in, the validator knows what can and can't be changed. Depending on your role, the validator lets you change certain things can be updated as well. A PATCH would need these too and now you have more code to deal with. Also, it requires the developer to now worry that they have all the fields for a complete object or not.
- BulgarianIdiot 5y agoBased on that description, you may be using PUT in conflict with its semantics (namely, idempotent way to replace an entire resource). This is one reason why I don't bother with these methods and stick to GET and POST.
- Supermancho 5y ago> I don't bother with these methods and stick to GET and POST. Most people don't bother with them. If you need caching or want to be able to manipulate params in the browser/link to resources, use GET. This idea that you need additional verbs for web services is a classic case of in-theory vs in-practice. Introducing non-trivial complication for very tiny benefit is a strange tradeoff.
- deleted 5y ago[deleted]
- bcrosby95 5y agoPUT can be useful if you have a client that tries to handle errors. For example, our mobile application will automatically retry a PUT.