3 ms·
> From my point of view, post, put, delete, update, and patch all do the same. That's how we got POST-only GraphQL. In HTTP (and hence REST) these verbs have
by troupo 1y ago
> From my point of view, post, put, delete, update, and patch all do the same.
That's how we got POST-only GraphQL.
In HTTP (and hence REST) these verbs have well-defined behaviour, including the very important things like idempotence and caching: https://github.com/for-GET/know-your-http-well/blob/master/methods.md https://github.com/for-GET/know-your-http-well/blob/master/m...
- lalaithion 1y agoYeah but GET doesn’t allow requests to have bodies (yeah, I know, technically you can but it’s not very useful), and this is a legitimate issue preventing its use in complex APIs.
- troupo 1y agoI've had situations when I wanted a GET with a body :) But not that many
- tgv 1y agoThere's no point in idempotency for operations that change the state. DELETE is supposed to be idempotent, but it can only be if you limit yourself to deletion by unique, non-repeating id. Should you do something like delete by email or product, you have to use another operation, which then obviously will be POST anyway. And there's no way to "cache" a delete operation. It's just absurd to mention idempotency when the state gets altered.
- troupo 1y ago> There's no point in idempotency for operations that change the state. Of course there is > DELETE is supposed to be idempotent, but it can only be if you limit yourself to deletion by unique, non-repeating id Which is most operations > Should you do something like delete by email or product, you have to use another operation, Erm.... No, you don't? > which then obviously will be POST anyway. And there's no way to "cache" a delete operation. Why would you want to cache a delete operation?
- andoando 1y agoThe defined behaviors are not so well defined for more complex APIs. You may have an API for example that updates one object and inserts another one, or even deletes an old resource and inserts a new one The verbs are only very clear for very simple CRUD operations. There is a lot of nuance otherwise that you need documentation for and having to deal with these verbs both as the developer or user of an API is a nuisance with no real benefit