| ▲ | 8cvor6j844qw_d6 3 hours ago | |||||||
For the experienced devs. May I ask why would one use POST for everything? I encountered a codebase with only POST for all operations, given my lack of knowledge in this area, I am not sure why one would choose POST only over the standard set of GET, PUT, POST, DELETE, etc. | ||||||||
| ▲ | zvrba 6 minutes ago | parent | next [-] | |||||||
Because with POST you have a RPC (remote procedure call) with arbitrary semantics and HTTPS is just a convenient transport. That's also why I only use a couple of status codes: Ok, Created, NoContent, BadRequest, Forbidden, Unauthorized an InternalServerError (the latter two generated automatically by the framework). GET, PUT, DELTE, etc. seem to be tailored towards entities, but as soon as the endpoint is not an "entity", the semantics get vague and break down. | ||||||||
| ▲ | nhumrich an hour ago | parent | prev | next [-] | |||||||
I prefer POST for everything. The main reason why is because HTTP verbs don't match cleanly to every operation. And it leads to a lot of bike shedding around the exceptions. POST for everything, on the other hand, forces you to put the "method" in the request outside of HTTP semantics, which allows you to "just use" whatever verb makes sense rather than trying to map it to the limited ones available. | ||||||||
| ||||||||
| ▲ | LudwigNagasena 44 minutes ago | parent | prev | next [-] | |||||||
Consistency, simplicity, RPC semantics. | ||||||||
| ▲ | RedShift1 36 minutes ago | parent | prev | next [-] | |||||||
The default for GraphQL queries is POST so maybe they were using that. | ||||||||
| ▲ | julianlam an hour ago | parent | prev [-] | |||||||
If you encounter a shop that uses POST for everything then they are probably a shop that doesn't know that verbs other than GET and POST exist. ... and they don't use GET everywhere because one time Google scraped that endpoint and dropped the production database. | ||||||||