5 ms·
Precisely right. Standards work cause everyone understands them. I know a PUT request is almost certainly an update of some kind. I know a POST makes something.
by irishloop 3y ago
Precisely right. Standards work cause everyone understands them. I know a PUT request is almost certainly an update of some kind. I know a POST makes something.
For most shit you wanna do, its view, edit, delete, its really not that complicated.
- jmondi 3y agoAm I the only one around here who hates the whole PUT PATCH nonsense? When I write APIs, you’re either querying data with a GET, or mutating data with a POST. Everything else is a waste of time.
- tacker2000 3y agoYea, I also frigging hate it. Everytime i need to plan out an API i stumble into a lengthy PUT/PATCH analysis and read up session that shouldnt really be necessary. POST should be the only thing needed, if the object already exists, mutate it, if not, create it, in 99% of the times you dont need the “idempotency” argument.
- kiitos 3y agoThis suggests you just don't grok HTTP semantics.
- jmondi 3y agoNo no, this just means I think the HTTP semantics are overkill, and a simple GET/POST gets across everything that I need to.
- kiitos 3y agoIf your application models a remote API in terms of endpoints which are either read-only/GET or read-write/POST, then you're subverting your own interests. There's no reason to constrain yourself in this way.
- richardw 3y agoOne team got a stream of 404’s not because the requested objects did not exist in the DB, but because the service moved. Web server was saying: resource does not exist. Another time, the server had the resource but didn’t like the state of the data, so refused to serve it. Debate ensued as to whether this was a 400 or 500 class error. People got religious. Yes there’s an answer but it should be so obvious that we don’t have the debate. This isn’t sophisticated verbs, both happened with GET.
- shortrounddev2 3y agoObviously a bad server state should be 500
- msla 3y agoYeah, from what I understand 400 means "fix it at the client's end" and 500 means "fix it at the server's end" which seems to be what the RFC thinks, too: https://httpwg.org/specs/rfc9110.html#overview.of.status.codes https://httpwg.org/specs/rfc9110.html#overview.of.status.cod... > The 4xx (Client Error) class of status code indicates that the client seems to have erred. > The 5xx (Server Error) class of status code indicates that the server is aware that it has erred or is incapable of performing the requested method.
- Takennickname 3y agoBasically, 4xx is telling the client you did something wrong (such as visit a non-existent URL), 5xx is when the server errors and can't respond appropriately.
- richardw 3y agoObvious to you and me. Server team disagreed and tried 422 unprocessable entity, which is not correct. My point is that these issues should be clear enough that there are not thousands of StackOverflow questions on it, and debates between teams. “It’s so easy” is not true. There are layers of understanding.