News for hackers. Stuff that matters.
Re:It's TCP vs. RPC All over Again by toast0 on Wednesday February 22, 2023 @11:58AM (#34898566)
All those verbs are just constants that provide some behavior.

POST is the constant that means I'm going to probably send you a body and probably nobody is going to try to add caching, which is usually what you want from an RPC. You can just #define DO POST, and you're set.

Re:It's TCP vs. RPC All over Again by cryptonector on Wednesday February 22, 2023 @01:35PM (#34900418)
And POST can come with a response body. And it can either create a new entity or not. It's what you want for an RPC, yes. That's why SOAP used it. Of course, it's not "RESTful", but hey.
Re:It's TCP vs. RPC All over Again by remram on Wednesday February 22, 2023 @03:15PM (#34901965)
RPC usually means stateful client so REST goes out the window.
Re:It's TCP vs. RPC All over Again by cryptonector on Wednesday February 22, 2023 @04:06PM (#34902740)
Browser clients of RESTful APIs can be stateless in a very stateful way because the DOM and JS allows the client to keep state. The statelessness of HTTP is supposed to be about the HTTP layer itself, not the application, and this is true as much about the client as about the server.

Consider a database application where the client is a browser and the server is just something like PostgREST, and then you see that the client stores state impliedly in the DOM (what rows it's displaying, which affects what the user might do next) and that the server keeps state in the database even though PostgREST itself is stateless. The whole thing is RESTful (because REST is in the name of PostgREST, duh; just kidding, it really is).

I think this RPC-means-stateful / REST-means-stateless dichotomy is just not quite right, and it leads to thinking like that in TFA. All RESTful really means is that you use appropriate HTTP verbs for the actions you're doing (especially HEAD and GET for reading so you can cache where caching makes sense), use HTTP status codes as much as possible, and give entities URIs (possibly derived on the fly) -- that's really it. If you have an RPC called `CreateWidgetyThing()` you can just as well have a POST to `/widgety-things` to create them -- it really is that simple.