5 ms·
What is the difference between RPC and API besides the URL & payload structure?
by pbreit 4y ago
What is the difference between RPC and API besides the URL & payload structure?
- efdee 4y agoREST is based around resources and kind of the polar opposite of RPC when it comes to writing APIs.
- whalesalad 4y agoREST is literally RPC. You are making a remote procedure call to a URL. GET this resource. DELETE this resource. It's the same thing. What is the difference between remote.perform('some-action', { payload }) and remote.POST('some-action', payload) ?
- efdee 4y agoThere is no difference: neither of those are REST. Calling an URL with an action in the path name (rather than a resource name) is technically not done in REST -- the action is expressed through your HTTP verb. Using GET/POST/DELETE directly does not mean you're doing REST - there's a whole set of rules and assumptions that come with it.
- pbreit 4y agoIs it though? Or is the difference mostly semantics? At then end of the day it's just barely different ways for issuing a "command".
- lxe 4y agoIt's just semantics. "managing remote resources" or "calling remote procedures" is all just network calls, usually http.
- naasking 4y agoSemantics are 90% of programming though. Learning syntax is simple, learning semantics is hard. Semantics structure how you think about problems and express solutions.
- pbreit 4y agoBut in this case there is almost no difference. Basically same payloads with a slightly different "command" format.
- naasking 4y agoIt's the same payloads with a slightly different command format if you structure your program in exactly the same way. The point is that you don't structure your program in exactly the same way in each case.
- sirsinsalot 4y agoSemantics is 90% of life!
- dahfizz 4y agoThat's rather handwavy. The question is about a performance benchmark. From a performance standpoint, rpc and rest are the same (http requests that execute code on the server). The "semantics" you assign to one or the other don't change the technical details about implementation and performance.
- MuffinFlavored 4y ago> it's all just data > it's all just computers > we're all just going to die anyway