REST vs JSON-RPC?












230















I'm trying to chose between REST and JSON-RPC for developing an API for a web application. Which one is easier to use for API clients?




Update 2015: I have found REST easier to develop and use for an API which is served on Web/HTTP, because the existing and mature HTTP protocol which is understood by both client and server can be leveraged by the API. For example response codes, headers, queries, post bodies, caching and many other features can be used by the API without any additional effort or setup.











share|improve this question




















  • 29





    REST is definitely the popular answer right now. I'm not convinced that it's always the right answer though. There could be an impedance mismatch between a resource-centric REST API and a problem domain that is inherently task or workflow based. If you find that you're having to do different types of PATCHes to the same resource or that certain tasks don't map to a specific resource, then you have to start to bend the REST paradigm. Do you use actions/commands as resources. Do you differentiate command types in the Content-Type header as parameters? Not sure there's a one-size-fits all answer.

    – Landon Poch
    Jan 22 '14 at 3:11








  • 23





    JSON-RPC is simple and consistent, a joy to use.

    – dnault
    May 22 '14 at 23:02






  • 1





    Its Aug 2015, I have implemented both client & server using REST, first 2 days was learning then I understood why it was popular. It was real joy once a small app is created, the client really has no work to remember various url path, the server on node.js & client in javascript shared same structure (url paths) to communicate. Wow! it was very swift, product got delivered in just 15 days, even writing from scratch. REST is the way go. Also note that Popular Apache CouchDB uses REST, a great database, are very proud they did in REST too. In simple, REST is RIGHT(correct) with clean interface.

    – Manohar Reddy Poreddy
    Aug 1 '15 at 4:53






  • 6





    It depends on the constraints you have or your primary goal. For example, if performance is a major aspect your way to go is JSON-RPC (e.g. High Performance Computing). If your primary goal is to be agnostic so as to provide a generic interface to be interpreted by others, your way to go is REST. If you want both goals, you have to include both protocols. Your needs define the solution.

    – Stathis Andronikos
    Aug 28 '15 at 8:11











  • @StathisAndronikos You are right, my main goal was ease of use and a good performance for web apps (not HPC).

    – Ali Shakiba
    Aug 28 '15 at 8:22


















230















I'm trying to chose between REST and JSON-RPC for developing an API for a web application. Which one is easier to use for API clients?




Update 2015: I have found REST easier to develop and use for an API which is served on Web/HTTP, because the existing and mature HTTP protocol which is understood by both client and server can be leveraged by the API. For example response codes, headers, queries, post bodies, caching and many other features can be used by the API without any additional effort or setup.











share|improve this question




















  • 29





    REST is definitely the popular answer right now. I'm not convinced that it's always the right answer though. There could be an impedance mismatch between a resource-centric REST API and a problem domain that is inherently task or workflow based. If you find that you're having to do different types of PATCHes to the same resource or that certain tasks don't map to a specific resource, then you have to start to bend the REST paradigm. Do you use actions/commands as resources. Do you differentiate command types in the Content-Type header as parameters? Not sure there's a one-size-fits all answer.

    – Landon Poch
    Jan 22 '14 at 3:11








  • 23





    JSON-RPC is simple and consistent, a joy to use.

    – dnault
    May 22 '14 at 23:02






  • 1





    Its Aug 2015, I have implemented both client & server using REST, first 2 days was learning then I understood why it was popular. It was real joy once a small app is created, the client really has no work to remember various url path, the server on node.js & client in javascript shared same structure (url paths) to communicate. Wow! it was very swift, product got delivered in just 15 days, even writing from scratch. REST is the way go. Also note that Popular Apache CouchDB uses REST, a great database, are very proud they did in REST too. In simple, REST is RIGHT(correct) with clean interface.

    – Manohar Reddy Poreddy
    Aug 1 '15 at 4:53






  • 6





    It depends on the constraints you have or your primary goal. For example, if performance is a major aspect your way to go is JSON-RPC (e.g. High Performance Computing). If your primary goal is to be agnostic so as to provide a generic interface to be interpreted by others, your way to go is REST. If you want both goals, you have to include both protocols. Your needs define the solution.

    – Stathis Andronikos
    Aug 28 '15 at 8:11











  • @StathisAndronikos You are right, my main goal was ease of use and a good performance for web apps (not HPC).

    – Ali Shakiba
    Aug 28 '15 at 8:22
















230












230








230


120






I'm trying to chose between REST and JSON-RPC for developing an API for a web application. Which one is easier to use for API clients?




Update 2015: I have found REST easier to develop and use for an API which is served on Web/HTTP, because the existing and mature HTTP protocol which is understood by both client and server can be leveraged by the API. For example response codes, headers, queries, post bodies, caching and many other features can be used by the API without any additional effort or setup.











share|improve this question
















I'm trying to chose between REST and JSON-RPC for developing an API for a web application. Which one is easier to use for API clients?




Update 2015: I have found REST easier to develop and use for an API which is served on Web/HTTP, because the existing and mature HTTP protocol which is understood by both client and server can be leveraged by the API. For example response codes, headers, queries, post bodies, caching and many other features can be used by the API without any additional effort or setup.








rest graphql rpc json-rpc






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 23:15







Ali Shakiba

















asked Feb 24 '13 at 21:29









Ali ShakibaAli Shakiba

10.7k165680




10.7k165680








  • 29





    REST is definitely the popular answer right now. I'm not convinced that it's always the right answer though. There could be an impedance mismatch between a resource-centric REST API and a problem domain that is inherently task or workflow based. If you find that you're having to do different types of PATCHes to the same resource or that certain tasks don't map to a specific resource, then you have to start to bend the REST paradigm. Do you use actions/commands as resources. Do you differentiate command types in the Content-Type header as parameters? Not sure there's a one-size-fits all answer.

    – Landon Poch
    Jan 22 '14 at 3:11








  • 23





    JSON-RPC is simple and consistent, a joy to use.

    – dnault
    May 22 '14 at 23:02






  • 1





    Its Aug 2015, I have implemented both client & server using REST, first 2 days was learning then I understood why it was popular. It was real joy once a small app is created, the client really has no work to remember various url path, the server on node.js & client in javascript shared same structure (url paths) to communicate. Wow! it was very swift, product got delivered in just 15 days, even writing from scratch. REST is the way go. Also note that Popular Apache CouchDB uses REST, a great database, are very proud they did in REST too. In simple, REST is RIGHT(correct) with clean interface.

    – Manohar Reddy Poreddy
    Aug 1 '15 at 4:53






  • 6





    It depends on the constraints you have or your primary goal. For example, if performance is a major aspect your way to go is JSON-RPC (e.g. High Performance Computing). If your primary goal is to be agnostic so as to provide a generic interface to be interpreted by others, your way to go is REST. If you want both goals, you have to include both protocols. Your needs define the solution.

    – Stathis Andronikos
    Aug 28 '15 at 8:11











  • @StathisAndronikos You are right, my main goal was ease of use and a good performance for web apps (not HPC).

    – Ali Shakiba
    Aug 28 '15 at 8:22
















  • 29





    REST is definitely the popular answer right now. I'm not convinced that it's always the right answer though. There could be an impedance mismatch between a resource-centric REST API and a problem domain that is inherently task or workflow based. If you find that you're having to do different types of PATCHes to the same resource or that certain tasks don't map to a specific resource, then you have to start to bend the REST paradigm. Do you use actions/commands as resources. Do you differentiate command types in the Content-Type header as parameters? Not sure there's a one-size-fits all answer.

    – Landon Poch
    Jan 22 '14 at 3:11








  • 23





    JSON-RPC is simple and consistent, a joy to use.

    – dnault
    May 22 '14 at 23:02






  • 1





    Its Aug 2015, I have implemented both client & server using REST, first 2 days was learning then I understood why it was popular. It was real joy once a small app is created, the client really has no work to remember various url path, the server on node.js & client in javascript shared same structure (url paths) to communicate. Wow! it was very swift, product got delivered in just 15 days, even writing from scratch. REST is the way go. Also note that Popular Apache CouchDB uses REST, a great database, are very proud they did in REST too. In simple, REST is RIGHT(correct) with clean interface.

    – Manohar Reddy Poreddy
    Aug 1 '15 at 4:53






  • 6





    It depends on the constraints you have or your primary goal. For example, if performance is a major aspect your way to go is JSON-RPC (e.g. High Performance Computing). If your primary goal is to be agnostic so as to provide a generic interface to be interpreted by others, your way to go is REST. If you want both goals, you have to include both protocols. Your needs define the solution.

    – Stathis Andronikos
    Aug 28 '15 at 8:11











  • @StathisAndronikos You are right, my main goal was ease of use and a good performance for web apps (not HPC).

    – Ali Shakiba
    Aug 28 '15 at 8:22










29




29





REST is definitely the popular answer right now. I'm not convinced that it's always the right answer though. There could be an impedance mismatch between a resource-centric REST API and a problem domain that is inherently task or workflow based. If you find that you're having to do different types of PATCHes to the same resource or that certain tasks don't map to a specific resource, then you have to start to bend the REST paradigm. Do you use actions/commands as resources. Do you differentiate command types in the Content-Type header as parameters? Not sure there's a one-size-fits all answer.

– Landon Poch
Jan 22 '14 at 3:11







REST is definitely the popular answer right now. I'm not convinced that it's always the right answer though. There could be an impedance mismatch between a resource-centric REST API and a problem domain that is inherently task or workflow based. If you find that you're having to do different types of PATCHes to the same resource or that certain tasks don't map to a specific resource, then you have to start to bend the REST paradigm. Do you use actions/commands as resources. Do you differentiate command types in the Content-Type header as parameters? Not sure there's a one-size-fits all answer.

– Landon Poch
Jan 22 '14 at 3:11






23




23





JSON-RPC is simple and consistent, a joy to use.

– dnault
May 22 '14 at 23:02





JSON-RPC is simple and consistent, a joy to use.

– dnault
May 22 '14 at 23:02




1




1





Its Aug 2015, I have implemented both client & server using REST, first 2 days was learning then I understood why it was popular. It was real joy once a small app is created, the client really has no work to remember various url path, the server on node.js & client in javascript shared same structure (url paths) to communicate. Wow! it was very swift, product got delivered in just 15 days, even writing from scratch. REST is the way go. Also note that Popular Apache CouchDB uses REST, a great database, are very proud they did in REST too. In simple, REST is RIGHT(correct) with clean interface.

– Manohar Reddy Poreddy
Aug 1 '15 at 4:53





Its Aug 2015, I have implemented both client & server using REST, first 2 days was learning then I understood why it was popular. It was real joy once a small app is created, the client really has no work to remember various url path, the server on node.js & client in javascript shared same structure (url paths) to communicate. Wow! it was very swift, product got delivered in just 15 days, even writing from scratch. REST is the way go. Also note that Popular Apache CouchDB uses REST, a great database, are very proud they did in REST too. In simple, REST is RIGHT(correct) with clean interface.

– Manohar Reddy Poreddy
Aug 1 '15 at 4:53




6




6





It depends on the constraints you have or your primary goal. For example, if performance is a major aspect your way to go is JSON-RPC (e.g. High Performance Computing). If your primary goal is to be agnostic so as to provide a generic interface to be interpreted by others, your way to go is REST. If you want both goals, you have to include both protocols. Your needs define the solution.

– Stathis Andronikos
Aug 28 '15 at 8:11





It depends on the constraints you have or your primary goal. For example, if performance is a major aspect your way to go is JSON-RPC (e.g. High Performance Computing). If your primary goal is to be agnostic so as to provide a generic interface to be interpreted by others, your way to go is REST. If you want both goals, you have to include both protocols. Your needs define the solution.

– Stathis Andronikos
Aug 28 '15 at 8:11













@StathisAndronikos You are right, my main goal was ease of use and a good performance for web apps (not HPC).

– Ali Shakiba
Aug 28 '15 at 8:22







@StathisAndronikos You are right, my main goal was ease of use and a good performance for web apps (not HPC).

– Ali Shakiba
Aug 28 '15 at 8:22














16 Answers
16






active

oldest

votes


















201





+50









The fundamental problem with RPC is coupling. RPC clients become tightly coupled to service implementation in several ways and it becomes very hard to change service implementation without breaking clients:




  • Clients are required to know procedure names;

  • Procedure parameters order, types and count matters. It's not that easy to change procedure signatures(number of arguments, order of arguments, argument types etc...) on server side without breaking client implementations;

  • RPC style doesn't expose anything but procedure endpoints + procedure arguments. It's impossible for client to determine what can be done next.


On the other hand in REST style it's very easy to guide clients by including control information in representations(HTTP headers + representation). For example:




  • It's possible (and actually mandatory) to embed links annotated with link relation types which convey meanings of these URIs;

  • Client implementations do not need to depend on particular procedure names and arguments. Instead, clients depend on message formats. This creates possibility to use already implemented libraries for particular media formats (e.g. Atom, HTML, Collection+JSON, HAL etc...)

  • It's possible to easily change URIs without breaking clients as far as they only depend on registered (or domain specific) link relations;

  • It's possible to embed form-like structures in representations, giving clients the possibility to expose these descriptions as UI capabilities if the end user is human;

  • Support for caching is additional advantage;

  • Standardised status codes;


There are many more differences and advantages on the REST side.






share|improve this answer





















  • 18





    What do you mean by "it's mandatory to embed links annotated with link relation types which convey meanings.." ?

    – pjz
    Aug 17 '13 at 1:35






  • 113





    "Clients are required to know procedure names" - that's not argument because with REST this name is hardcoded into the URI instead of passing as parameter. Otherwise server won't know which method it should perform.

    – Centurion
    May 8 '14 at 6:59






  • 39





    "It's not that easy to change procedure signatures ... on server side without breaking client implementations", this also is debatable. Both REST and JSON-RPC are not SOAP and don't have WSDL that describes existing web services and their types so that could be used for dynamic change at client side. So, either way if you change web service you have to change the client. Otherwise you need to go with SOAP.

    – Centurion
    May 8 '14 at 7:04








  • 59





    I have coded dosen of apps and yet didn't see any flexible web services. If you change backend and web services than the client always needs to be refactored / updated to fit new requirements. And I have mentioned SOAP and because it has something that gives flexibility, like WSDL, so you can automate something and have more flexibility because you can get info about result set, datatypes and available web services. REST and others don't have that at all. So nor REST, nor JSON-RPC, nor other web service type will give you magic that would eliminate the need for manual client updating.

    – Centurion
    May 11 '14 at 18:54








  • 12





    For me, my current team and previous teams, RESTful web services are for CRUD type applications. Regarding "Do we rewrite browsers each time when something changes on server?" - no, because browsers are just HTTP executors, they have nothing to do with business logic, that client program needs to implement (show screens, perform related stuff). It looks like we have started flame war, but in general I wish I would have another solid source for RESTfull web services with practical usage flow, with magical flexibility that you are referring to. Meanwhile a lot of statements are too vague.

    – Centurion
    May 12 '14 at 6:43



















151














I have explored the issue in some detail and decided that pure REST is way too limiting, and RPC is best, even though most of my apps are CRUD apps. If you stick to REST, you eventually are going to be scratching your head wondering how you can easily add another needed method to your API for some special purpose. In many cases, the only way to do that with REST is to create another controller for it, which may unduly complicate your program.



If you decide on RPC, the only difference is that you are explicitly specifying the verb as part of the URI, which is clear, consistent, less buggy, and really no trouble. Especially if you create an app that goes way beyond simple CRUD, RPC is the only way to go. I have another issue with RESTful purists: HTTP POST, GET, PUT, DELETE have definite meanings in HTTP which have been subverted by REST into meaning other things, simply because they fit most of the time - but not all of the time.



In programming, I have long ago found that trying to use one thing to mean two things is going to come around sometime and bite you. I like to have the ability to use POST for just about every action, because it provides the freedom to send and receive data as your method needs to do. You can't fit the whole world into CRUD.






share|improve this answer





















  • 28





    This answer shows the all-too usual misconception of what REST actually is. REST is definitely not just a mapping of CRUD to HTTP methods. The idea that it is a problem to "add another method" clearly indicates that REST is misunderstood as RPC over HTTP, which it is not at all. Try reading Roy Fieldings blog or his dissertation - Google will help you find it - you are not describing REST at all in your answer.

    – nepdev
    Jan 23 '15 at 20:55






  • 62





    I am a very practical person. All descriptions of REST that I have read clearly start with a mapping of CRUD to HTTP methods. More is allowed to be added theoretically, but in practicality, not. As an example, I recently wanted to implement PATCH for Android devices, but found that Android does not allow PATCH, so I used POST with an explicitly defined action to that effect in the URI. Basically, pure REST won't do the jobs that I require, so I use what works.

    – Bruce Patin
    Jan 25 '15 at 2:26






  • 4





    So @BrucePatin, in your version "REST" you have a controller with four public methods that map 1 to 1 with GET|PUT|POST|DELETE? Some frameworks do that but that is not REST. HTTP verbs make vague abstract assertions about the semantics of a given request. You have to map your end points into those classes appropriately. GET could map to many different end points, so could the others. There is in fact no reason you can't implement REST-ful JSON-RPC over HTTP.

    – spinkus
    Mar 9 '15 at 21:18








  • 4





    There is a very good reason. I might want several dozen actions, and have already run into a common use (Android) that does not even support PATCH. That kills it cold. I would rather be consistent than have to deal with several exceptions to the rule. In general, I will now only use GET, POST and DELETE. PUT does not allow for the feedback I would want on an update operation. I am using POST for almost everything. Regarding caching, it has caused many problems by returning old data. Regarding putting parameters in POST, ASP.NET already handles it automatically from automatic JSON objects.

    – Bruce Patin
    Mar 11 '15 at 0:03






  • 18





    I believe the bickering over what REST really is only underscores your comments and highlights a major shortcoming of REST. Conceptually it's difficult to find two people who completely agree on what RESTful is. Anyway it doesn't matter because no service should go undocumented RPC or REST. If it's documented then the developer who uses it should have no problems.

    – Agile Jedi
    May 22 '15 at 22:35



















28














First, HTTP-REST is a "representational state transfer" architecture. This implies a lot of interesting things:




  • Your API will be stateless and therefore much easier to design (it's really easy to forget a transition in a complex automaton), and to integrate with independent software parts.

  • You will be lead to design read methods as safe ones, which will be easy to cache, and to integrate.

  • You will be lead to design write methods as idempotent ones, which will deal much better with timeouts.


Second, HTTP-REST is fully compliant with HTTP (see "safe" and "idempotent" in the previous part), therefore you will be able to reuse HTTP libraries (existing for every existing language) and HTTP reverse proxies, which will give you the ability to implement advanced features (cache, authentication, compression, redirection, rewriting, logging, etc.) with zero line of code.



Last but not least, using HTTP as an RPC protocol is a huge error according to the designer of HTTP 1.1 (and inventor of REST): http://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm#sec_6_5_2






share|improve this answer



















  • 1





    +1 for the authoritative, guy-who-should-know reference.... It's hard to argue for RPC over HTTP after that, without acknowledging it as a hack/work-around....

    – RJB
    Mar 23 '15 at 18:12






  • 9





    You just referenced something from 2000. It's more a philosophical argument for REST versus RPC. Semantically and applying an RPC pattern you can easily consider the URI to be the "procedure" and the encoded parameters to be ...well...the parameters. Either pattern would work just fine over HTTP. Same with SOAP, RAILS or any other number of patterns/protocols that have been overlayed onto HTTP. It doesn't matter as long as you offer a consistent API that doesn't break it's contract.

    – Agile Jedi
    May 15 '15 at 2:28











  • Aurélien, could you justify, why REST is easier to integrate with independent software parts? To me, regardless if you use RESTful API or RPC, the client software need to know the format your API talks.

    – Alexey
    May 2 '16 at 11:56






  • 1





    @Alexey This argument was relative to statelessness. It is easier to integrate a coffee machine whose API is CREATE CUP, than another that would contain INSERT COIN, SELECT COFFEE, SELECT SUGAR, and START. In the second API, because it depends on the machine state, you have to be very careful with the sequence of procedure calls.

    – Aurélien
    May 2 '16 at 12:31






  • 1





    HTTP as a RPC protocol is REST. So your incorrect interpretation is shockingly the other way around.

    – Tiberiu-Ionuț Stan
    Aug 13 '16 at 10:57



















25














Great answers - just wanted to clarify on a some of the comments. JSON-RPC is quick and easy to consume, but as mentioned resources and parameters are tightly coupled and it tends to rely on verbs (api/deleteUser, api/addUser) using GET/ POST where-as REST provides loosely coupled resources (api/users) that in a HTTP REST API relies on several HTTP methods (GET, POST, PUT, PATCH, DELETE). REST is slightly harder for inexperienced developers to implement, but the style has become fairly common place now and it provides much more flexibility in the long-run (giving your API a longer life).



Along with not having tightly coupled resources, REST also allows you to avoid being committed to a single content-type- this means if your client needs to receive the data in XML, or JSON, or even YAML - if built into your system you could return any of those using the content-type/ accept headers.



This lets you keep your API flexible enough to support new content types OR client requirements.



But what truly separates REST from JSON-RPC is that it follows a series of carefully thought out constraints- ensuring architectural flexibility. These constraints include ensuring that the client and server are able to evolve independently of each other (you can make changes without messing up your client's application), the calls are stateless (state is represented through hypermedia), a uniform interface is provided for interactions, the API is developed on a layered system, and the response is cacheable by the client. There's also an optional constraint for providing code on demand.



However, with all of this said - MOST APIs are not RESTful (according to Fielding) as they do not incorporate hypermedia (embedded hypertext links in the response that help navigate the API). Most APIs you will find out there are REST-like in that they follow most of the concepts of REST, but ignore this constraint. However, more and more APIs are implementing this and it is becoming more of a main-stream practice.



This also gives you some flexibility as hypermedia driven APIs (such as Stormpath) direct the client to the URIs (meaning if something changes, in certain cases you can modify the URI without negative impact), where-as with RPC URIs are required to be static. With RPC, you will also need to extensively document these different URIs and explain how they work in relation to each other.



In general, I would say REST is the way to go if you want to build an extensible, flexible API that will be long-lived. For that reason, I would say it's the route to go 99% of the time.



Good luck,
Mike






share|improve this answer



















  • 2





    it's not SLIGHTLY harder, but rather extremely more difficult. I've been trying to understand it for 4 months or so, and still don't have a good handle of how to write a service that doesn't devolve into a stateless RPC over http using json, And I'm still not convinced there's a real difference between "REST" and what I just said

    – Austin_Anderson
    Aug 2 '17 at 20:19



















17














If your service works fine with only models and the GET/POST/PUT/DELETE pattern, use pure REST.



I agree that HTTP is originally designed for stateless applications.



But for modern, more complex (!) real-time (web) applications where you will want to use Websockets (which often imply statefulness), why not use both? JSON-RPC over Websockets is very light so you have the following benefits:




  • Instant updates on every client (define your own server-to-client RPC call for updating the models)

  • Easy to add complexity (try to make an Etherpad clone with only REST)

  • If you do it right (add RPC only as an extra for real-time), most is still usable with only REST (except if the main feature is a chat or something)


As you are only designing the server side API, start with defining REST models and later add JSON-RPC support as needed, keeping the number of RPC calls to a minimum.



(and sorry for parentheses overuse)






share|improve this answer































    15














    IMO, the key point is the action vs resource orientation. REST is resource-oriented and fits well for CRUD operations and given its known semantics provides some predictability to a first user, but when implemented from methods or procedures forces you to provide an artificial translation to the resource centered world. On the other hand RPC suits perfectly to action-oriented APIs, where you expose services, not CRUD-able resource sets.



    No doubt REST is more popular, this definitely adds some points if you want to expose the API to a third party.



    If not (for example in case of creating an AJAX front-end in a SPA), my choice is RPC. In particular JSON-RPC, combined with JSON Schema as description language, and transported over HTTP or Websockets depending on the use case.



    JSON-RPC is a simple and elegant specification that defines request and response JSON payloads to be used in synchronous or asynchronous RPC.



    JSON Schema is draft specification defining a JSON based format aimed at describing JSON data. By describing your service input and output messages using JSON Schema you can have an arbitrary complexity in the message structure without compromising usability, and service integration can be automatized.



    The choice of transport protocol (HTTP vs websockets) depends on different factors, being the most important whether you need HTTP features (caching, revalidation, safety, idempotence, content-type, multipart, ...) or whether you application needs to interchange messages at high frecuencies.



    Until now it is very much my personal opinion on the issue, but now something that can be really helpful for those Java developers reading these lines, the framework I have been working on during the last year, born from the same question you are wondering now:



    http://rpc.brutusin.org



    You can see a live demo here, showing the built-in repository browser for functional testing (thanks JSON Schema) and a series of example services:



    http://demo.rpc.brutusin.org



    Hope it helps mate!



    Nacho






    share|improve this answer


























    • It's great to find a kindred spirit! I'm working on something similar over here: github.com/dnault/therapi-json-rpc

      – dnault
      Mar 17 '16 at 22:06













    • :) I'll look into it

      – idelvall
      Mar 18 '16 at 8:29











    • Agree with this. REST works well for CRUD APIs since you have the obvious POST/GET/PUT/DELETE [PoGPuD? ;)] mapping. However, if your API doesn't fit comfortably in to those verbs, JSON-RPC may be a good option since the verbs are just going to confuse matters. So yeah, who's using it and why is a big factor.

      – Algy Taylor
      Dec 9 '16 at 13:07








    • 1





      Exactly - REST is the kingdom of the nouns, JSON-RPC is verbs.

      – Robert Grant
      Jan 2 '17 at 9:09



















    14














    I've been a big fan of REST in the past and it has many advantages over RPC on paper. You can present the client with different Content-Types, Caching, reuse of HTTP status codes, you can guide the client through the API and you can embed documentation in the API if it isn't mostly self-explaining anyway.



    But my experience has been that in practice this doesn't hold up and instead you do a lot of unnecessary work to get everything right. Also the HTTP status codes often don't map to your domain logic exactly and using them in your context often feels a bit forced. But the worst thing about REST in my opinion is that you spend a lot of time to design your resources and the interactions they allow. And whenever you do some major additions to your API you hope you find a good solution to add the new functionality and you didn't design yourself into a corner already.



    This often feels like a waste of time to me because most of the time I already have a perfectly fine and obvious idea about how to model an API as a set of remote procedure calls. And if I have gone through all this effort to model my problem inside the constraints of REST the next problem is how to call it from the client? Our programs are based on calling procedures so building a good RPC client library is easy, building a good REST client library not so much and in most cases you will just map back from your REST API on the server to a set of procedures in your client library.



    Because of this, RPC feels a lot simpler and more natural to me today. What I really miss though is a consistent framework that makes it easy to write RPC services that are self-describing and interoperable. Therefore I created my own project to experiment with new ways to make RPC easier for myself and maybe somebody else finds it useful, too: https://github.com/aheck/reflectrpc






    share|improve this answer































      11














      According to the Richardson maturity model, the question is not REST vs. RPC, but how much REST?



      In this view, the compliance to REST standard can be classified in 4 levels.




      • level 0: think in terms of actions and parameters. As the article explains, this is essentially equivalent to JSON-RPC (the article explains it for XML-RPC, but same arguments hold for both).

      • level 1: think in terms of resources. Everything relevant to a resource belong to the same URL

      • level 2: use HTTP verbs

      • level 3: HATEOAS


      According to the creator of REST standard, only level 3 services can be called RESTful. However, this is a metric of compliance, not quality. If you just want to call a remote function that does a calculation, it probably makes no sense to have relevant hypermedia links in the response, neither differentiation of behavior based on the HTTP verb used. So, a such call inherently tends to be more RPC-like. However, lower compliance level does not necessarily mean statefulness, or higher coupling. Probably, instead of thinking REST vs. RPC, you should use as much REST as possible, but no more. Do not twist your application just to fit with the RESTful compliance standards.






      share|improve this answer
























      • +1 for levels 0, 1, and 2. However I've never seen a successful implementation of HATEOS, but have seen two miserably failed attempts.

        – mjhm
        Mar 21 '18 at 17:42



















      6














      Why JSON RPC:



      In case of REST apis, we have to define a controller for each functionality/method we might need. As a result if we have 10 methods that we want accessible to a client, we have to write 10 controllers to interface the client's request to a particular method.



      Another factor is, even though we have different controllers for each method/functionality, the client has to remember wether to use POST or GET. This complicates things further. On top of that to send data, one has to set the content type of the request if POST is used.



      In case of JSON RPC, things are greatly simplified because most JSONRPC servers operate on POST HTTP methods and the content type is always application/json. This takes the load off of remembering to use proper HTTP method and content settings on client side.



      One doesn't have to create separate controllers for different methods/functionalities the server wants to expose to a client.



      Why REST:



      You have separate URLs for different functionality the server wants to expose to client side. As a result, you can embed these urls.



      Most of these points are debatable and completely depend upon the need of a person.






      share|improve this answer

































        2














        If you request resources, then RESTful API is better by design. If you request some complicated data with a lot of parameters and complicated methods other than simple CRUD, then RPC is the right way to go.






        share|improve this answer































          2














          Wrong question: imposes a manichean that not exist!



          You can use JSON-RPC with "less verb" (no method) and preserve the minimal standardization necessary for sendo id, parameters, error codes and warning messages. The JSON-RPC standard not say "you can't be REST", only say how to pack basic information.



          "REST JSON-RPC" exists! is REST with "best practices", for minimal information packing, with simple and solid contracts.





          Example



          (from this answer and didactic context)



          When dealing with REST, it generally helps to start by thinking in terms of resources. In this case, the resource is not just "bank account" but it is a transaction of that bank account... But JSON-RPC not obligates the "method" parameter, all are encoded by "path" of the endpoint.




          • REST Deposit with POST /Bank/Account/John/Transaction with JSON request {"jsonrpc": "2.0", "id": 12, "params": {"currency":"USD","amount":10}}.
            The JSON response can be something as {"jsonrpc": "2.0", "result": "sucess", "id": 12}


          • REST Withdraw with POST /Bank/Account/John/Transaction ... similar.


          • ... GET /Bank/Account/John/Transaction/12345@13 ... This could return a JSON record of that exact transaction (e.g. your users generally want a record of debits and credits on their account). Something as {"jsonrpc": "2.0", "result": {"debits":[...],"credits":[...]}, "id": 13}. The convention about (REST) GET request can include encode of id by "@id", so not need to send any JSON, but still using JSON-RPC in the response pack.







          share|improve this answer


























          • See also stackoverflow.com/a/13952665/287948

            – Peter Krauss
            Jan 16 '17 at 22:41



















          2














          I think, as always, it depends ...



          REST has the huge advantage of widespread public support and this means lots of tools and books. If you need to make an API that is used by a large number of consumers from different organisations then it is the way to go for only one reason: it is popular. As a protocol it is of course a total failure since there are too many completely different ways to map a command to a URL/verb/response.



          Therefore, when you write a single page web app that needs to talk to a backend then I think REST is way too complex. In this situation you do not have to worry about long term compatibility since the app and API can evolved together.



          I once started with REST for a single page web app but the fine grained commands between the web app and the server quickly drove me crazy. Should I encode it as a path parameter? In the body? A query parameter? A header? After the URL/Verb/Response design I then had to code this mess in Javascript, the decoder in Java and then call the actual method. Although there are lots of tools for it, it is really tricky to not get any HTTP semantics in your domain code, which is really bad practice. (Cohesion)



          Try making a Swagger/OpenAPI file for a medium complex site and compare that to a single Java interface that describes the remote procedures in that file. The complexity increase is staggering.



          I therefore switched from REST to JSON-RPC for the single page webapp. aI developed a tiny library that encoded a Java interface on the server and shipped it to the browser. In the browser this created a proxy for the application code that returned a promise for each function.



          Again, REST has its place just because it is famous and therefore well supported. It is also important to recognise the underlying stateless resources philosophy and the hierarchical model. However, these principles can just as easy be used in an RPC model. JSON RPC works over HTTP so it has the same advantages of REST in this area. The difference is that when you inevitably run into these functions that do not map well to these principles you're not forced to do a lot of unnecessary work.






          share|improve this answer





















          • 1





            This answer made me realise the similarities between GraphQL and JSON-RPC and why GraphQL is becoming a popular choice for SPAs.

            – Dennis
            Nov 15 '17 at 16:38



















          1














          REST is tightly coupled with HTTP, so if you only expose your API over HTTP then REST is more appropriate for most (but not all) situations. However, if you need to expose your API over other transports like messaging or web sockets then REST is just not applicable.






          share|improve this answer



















          • 1





            REST is an architectural style and not protocol-dependant.

            – Mark Cidade
            Jun 9 '17 at 19:10











          • You are right REST is architectural principle. However, its theoretical foundation was heavily influenced by HTTP protocol and despite the claim of universal applicability it found no practical application beyond web domain. So, it is safe to say that when somebody mentions REST they refer to web services and not the architectural principle.

            – dtoux
            Jun 10 '17 at 23:27



















          0














          I think there is one point people forgot to mention.
          If you already have a web app, then REST is desirable since you'll need the app server anyways and you can secure both using https...
          but if you do not have a web app, (just have an application), then RPC is desirable since you no longer need to setup an app server and configure it which is a hastle.
          Other than than, I don't see any real fundamental advantage in either.






          share|improve this answer































            0














            It would be better to choose JSON-RPC between REST and JSON-RPC to develop an API for a web application that is easier to understand. JSON-RPC is preferred because its mapping to method calls and communications can be easily understood.



            Choosing the most suitable approach depends on the constraints or principal objective. For example, as far as performance is a major trait, it is advisable to go for JSON-RPC (for example, High Performance Computing). However, if the principal objective is to be agnostic in order to offer a generic interface to be inferred by others, it is advisable to go for REST. If you both goals are needed to be achieved, it is advisable to include both protocols.



            The fact which actually splits REST from JSON-RPC is that it trails a series of carefully thought out constraints- confirming architectural flexibility. The constraints take in ensuring that the client as well as server are able to grow independently of each other (changes can be made without messing up with the application of client), the calls are stateless (the state is regarded as hypermedia), a uniform interface is offered for interactions, the API is advanced on a layered system (Hall, 2010). JSON-RPC is rapid and easy to consume, however as mentioned resources as well as parameters are tightly coupled and it is likely to depend on verbs (api/addUser, api/deleteUser) using GET/ POST whereas REST delivers loosely coupled resources (api/users) in a HTTP. REST API depends up on several HTTP methods such as GET, PUT, POST, DELETE, PATCH. REST is slightly tougher for inexperienced developers to implement.



            JSON (denoted as JavaScript Object Notation) being a lightweight data-interchange format, is easy for humans to read as well as write. It is hassle free for machines to parse and generate. JSON is a text format which is entirely language independent but practices conventions that are acquainted to programmers of the family of languages, consisting of C#, C, C++, Java, Perl, JavaScript, Python, and numerous others. Such properties make JSON a perfect data-interchange language and a better choice to opt for.






            share|improve this answer































              0














              I use vdata for RPC protocol:
              http://vdata.dekuan.org/



              1, PHP and JavaScript are both okay.
              2, Cross-origin resource sharing(CORS) call is still okay.






              share|improve this answer






















                protected by cassiomolin 2 days ago



                Thank you for your interest in this question.
                Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                Would you like to answer one of these unanswered questions instead?














                16 Answers
                16






                active

                oldest

                votes








                16 Answers
                16






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                201





                +50









                The fundamental problem with RPC is coupling. RPC clients become tightly coupled to service implementation in several ways and it becomes very hard to change service implementation without breaking clients:




                • Clients are required to know procedure names;

                • Procedure parameters order, types and count matters. It's not that easy to change procedure signatures(number of arguments, order of arguments, argument types etc...) on server side without breaking client implementations;

                • RPC style doesn't expose anything but procedure endpoints + procedure arguments. It's impossible for client to determine what can be done next.


                On the other hand in REST style it's very easy to guide clients by including control information in representations(HTTP headers + representation). For example:




                • It's possible (and actually mandatory) to embed links annotated with link relation types which convey meanings of these URIs;

                • Client implementations do not need to depend on particular procedure names and arguments. Instead, clients depend on message formats. This creates possibility to use already implemented libraries for particular media formats (e.g. Atom, HTML, Collection+JSON, HAL etc...)

                • It's possible to easily change URIs without breaking clients as far as they only depend on registered (or domain specific) link relations;

                • It's possible to embed form-like structures in representations, giving clients the possibility to expose these descriptions as UI capabilities if the end user is human;

                • Support for caching is additional advantage;

                • Standardised status codes;


                There are many more differences and advantages on the REST side.






                share|improve this answer





















                • 18





                  What do you mean by "it's mandatory to embed links annotated with link relation types which convey meanings.." ?

                  – pjz
                  Aug 17 '13 at 1:35






                • 113





                  "Clients are required to know procedure names" - that's not argument because with REST this name is hardcoded into the URI instead of passing as parameter. Otherwise server won't know which method it should perform.

                  – Centurion
                  May 8 '14 at 6:59






                • 39





                  "It's not that easy to change procedure signatures ... on server side without breaking client implementations", this also is debatable. Both REST and JSON-RPC are not SOAP and don't have WSDL that describes existing web services and their types so that could be used for dynamic change at client side. So, either way if you change web service you have to change the client. Otherwise you need to go with SOAP.

                  – Centurion
                  May 8 '14 at 7:04








                • 59





                  I have coded dosen of apps and yet didn't see any flexible web services. If you change backend and web services than the client always needs to be refactored / updated to fit new requirements. And I have mentioned SOAP and because it has something that gives flexibility, like WSDL, so you can automate something and have more flexibility because you can get info about result set, datatypes and available web services. REST and others don't have that at all. So nor REST, nor JSON-RPC, nor other web service type will give you magic that would eliminate the need for manual client updating.

                  – Centurion
                  May 11 '14 at 18:54








                • 12





                  For me, my current team and previous teams, RESTful web services are for CRUD type applications. Regarding "Do we rewrite browsers each time when something changes on server?" - no, because browsers are just HTTP executors, they have nothing to do with business logic, that client program needs to implement (show screens, perform related stuff). It looks like we have started flame war, but in general I wish I would have another solid source for RESTfull web services with practical usage flow, with magical flexibility that you are referring to. Meanwhile a lot of statements are too vague.

                  – Centurion
                  May 12 '14 at 6:43
















                201





                +50









                The fundamental problem with RPC is coupling. RPC clients become tightly coupled to service implementation in several ways and it becomes very hard to change service implementation without breaking clients:




                • Clients are required to know procedure names;

                • Procedure parameters order, types and count matters. It's not that easy to change procedure signatures(number of arguments, order of arguments, argument types etc...) on server side without breaking client implementations;

                • RPC style doesn't expose anything but procedure endpoints + procedure arguments. It's impossible for client to determine what can be done next.


                On the other hand in REST style it's very easy to guide clients by including control information in representations(HTTP headers + representation). For example:




                • It's possible (and actually mandatory) to embed links annotated with link relation types which convey meanings of these URIs;

                • Client implementations do not need to depend on particular procedure names and arguments. Instead, clients depend on message formats. This creates possibility to use already implemented libraries for particular media formats (e.g. Atom, HTML, Collection+JSON, HAL etc...)

                • It's possible to easily change URIs without breaking clients as far as they only depend on registered (or domain specific) link relations;

                • It's possible to embed form-like structures in representations, giving clients the possibility to expose these descriptions as UI capabilities if the end user is human;

                • Support for caching is additional advantage;

                • Standardised status codes;


                There are many more differences and advantages on the REST side.






                share|improve this answer





















                • 18





                  What do you mean by "it's mandatory to embed links annotated with link relation types which convey meanings.." ?

                  – pjz
                  Aug 17 '13 at 1:35






                • 113





                  "Clients are required to know procedure names" - that's not argument because with REST this name is hardcoded into the URI instead of passing as parameter. Otherwise server won't know which method it should perform.

                  – Centurion
                  May 8 '14 at 6:59






                • 39





                  "It's not that easy to change procedure signatures ... on server side without breaking client implementations", this also is debatable. Both REST and JSON-RPC are not SOAP and don't have WSDL that describes existing web services and their types so that could be used for dynamic change at client side. So, either way if you change web service you have to change the client. Otherwise you need to go with SOAP.

                  – Centurion
                  May 8 '14 at 7:04








                • 59





                  I have coded dosen of apps and yet didn't see any flexible web services. If you change backend and web services than the client always needs to be refactored / updated to fit new requirements. And I have mentioned SOAP and because it has something that gives flexibility, like WSDL, so you can automate something and have more flexibility because you can get info about result set, datatypes and available web services. REST and others don't have that at all. So nor REST, nor JSON-RPC, nor other web service type will give you magic that would eliminate the need for manual client updating.

                  – Centurion
                  May 11 '14 at 18:54








                • 12





                  For me, my current team and previous teams, RESTful web services are for CRUD type applications. Regarding "Do we rewrite browsers each time when something changes on server?" - no, because browsers are just HTTP executors, they have nothing to do with business logic, that client program needs to implement (show screens, perform related stuff). It looks like we have started flame war, but in general I wish I would have another solid source for RESTfull web services with practical usage flow, with magical flexibility that you are referring to. Meanwhile a lot of statements are too vague.

                  – Centurion
                  May 12 '14 at 6:43














                201





                +50







                201





                +50



                201




                +50





                The fundamental problem with RPC is coupling. RPC clients become tightly coupled to service implementation in several ways and it becomes very hard to change service implementation without breaking clients:




                • Clients are required to know procedure names;

                • Procedure parameters order, types and count matters. It's not that easy to change procedure signatures(number of arguments, order of arguments, argument types etc...) on server side without breaking client implementations;

                • RPC style doesn't expose anything but procedure endpoints + procedure arguments. It's impossible for client to determine what can be done next.


                On the other hand in REST style it's very easy to guide clients by including control information in representations(HTTP headers + representation). For example:




                • It's possible (and actually mandatory) to embed links annotated with link relation types which convey meanings of these URIs;

                • Client implementations do not need to depend on particular procedure names and arguments. Instead, clients depend on message formats. This creates possibility to use already implemented libraries for particular media formats (e.g. Atom, HTML, Collection+JSON, HAL etc...)

                • It's possible to easily change URIs without breaking clients as far as they only depend on registered (or domain specific) link relations;

                • It's possible to embed form-like structures in representations, giving clients the possibility to expose these descriptions as UI capabilities if the end user is human;

                • Support for caching is additional advantage;

                • Standardised status codes;


                There are many more differences and advantages on the REST side.






                share|improve this answer















                The fundamental problem with RPC is coupling. RPC clients become tightly coupled to service implementation in several ways and it becomes very hard to change service implementation without breaking clients:




                • Clients are required to know procedure names;

                • Procedure parameters order, types and count matters. It's not that easy to change procedure signatures(number of arguments, order of arguments, argument types etc...) on server side without breaking client implementations;

                • RPC style doesn't expose anything but procedure endpoints + procedure arguments. It's impossible for client to determine what can be done next.


                On the other hand in REST style it's very easy to guide clients by including control information in representations(HTTP headers + representation). For example:




                • It's possible (and actually mandatory) to embed links annotated with link relation types which convey meanings of these URIs;

                • Client implementations do not need to depend on particular procedure names and arguments. Instead, clients depend on message formats. This creates possibility to use already implemented libraries for particular media formats (e.g. Atom, HTML, Collection+JSON, HAL etc...)

                • It's possible to easily change URIs without breaking clients as far as they only depend on registered (or domain specific) link relations;

                • It's possible to embed form-like structures in representations, giving clients the possibility to expose these descriptions as UI capabilities if the end user is human;

                • Support for caching is additional advantage;

                • Standardised status codes;


                There are many more differences and advantages on the REST side.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 15 '17 at 17:29









                Dennis

                30.9k18106107




                30.9k18106107










                answered Feb 27 '13 at 15:58









                iosebioseb

                14.3k22427




                14.3k22427








                • 18





                  What do you mean by "it's mandatory to embed links annotated with link relation types which convey meanings.." ?

                  – pjz
                  Aug 17 '13 at 1:35






                • 113





                  "Clients are required to know procedure names" - that's not argument because with REST this name is hardcoded into the URI instead of passing as parameter. Otherwise server won't know which method it should perform.

                  – Centurion
                  May 8 '14 at 6:59






                • 39





                  "It's not that easy to change procedure signatures ... on server side without breaking client implementations", this also is debatable. Both REST and JSON-RPC are not SOAP and don't have WSDL that describes existing web services and their types so that could be used for dynamic change at client side. So, either way if you change web service you have to change the client. Otherwise you need to go with SOAP.

                  – Centurion
                  May 8 '14 at 7:04








                • 59





                  I have coded dosen of apps and yet didn't see any flexible web services. If you change backend and web services than the client always needs to be refactored / updated to fit new requirements. And I have mentioned SOAP and because it has something that gives flexibility, like WSDL, so you can automate something and have more flexibility because you can get info about result set, datatypes and available web services. REST and others don't have that at all. So nor REST, nor JSON-RPC, nor other web service type will give you magic that would eliminate the need for manual client updating.

                  – Centurion
                  May 11 '14 at 18:54








                • 12





                  For me, my current team and previous teams, RESTful web services are for CRUD type applications. Regarding "Do we rewrite browsers each time when something changes on server?" - no, because browsers are just HTTP executors, they have nothing to do with business logic, that client program needs to implement (show screens, perform related stuff). It looks like we have started flame war, but in general I wish I would have another solid source for RESTfull web services with practical usage flow, with magical flexibility that you are referring to. Meanwhile a lot of statements are too vague.

                  – Centurion
                  May 12 '14 at 6:43














                • 18





                  What do you mean by "it's mandatory to embed links annotated with link relation types which convey meanings.." ?

                  – pjz
                  Aug 17 '13 at 1:35






                • 113





                  "Clients are required to know procedure names" - that's not argument because with REST this name is hardcoded into the URI instead of passing as parameter. Otherwise server won't know which method it should perform.

                  – Centurion
                  May 8 '14 at 6:59






                • 39





                  "It's not that easy to change procedure signatures ... on server side without breaking client implementations", this also is debatable. Both REST and JSON-RPC are not SOAP and don't have WSDL that describes existing web services and their types so that could be used for dynamic change at client side. So, either way if you change web service you have to change the client. Otherwise you need to go with SOAP.

                  – Centurion
                  May 8 '14 at 7:04








                • 59





                  I have coded dosen of apps and yet didn't see any flexible web services. If you change backend and web services than the client always needs to be refactored / updated to fit new requirements. And I have mentioned SOAP and because it has something that gives flexibility, like WSDL, so you can automate something and have more flexibility because you can get info about result set, datatypes and available web services. REST and others don't have that at all. So nor REST, nor JSON-RPC, nor other web service type will give you magic that would eliminate the need for manual client updating.

                  – Centurion
                  May 11 '14 at 18:54








                • 12





                  For me, my current team and previous teams, RESTful web services are for CRUD type applications. Regarding "Do we rewrite browsers each time when something changes on server?" - no, because browsers are just HTTP executors, they have nothing to do with business logic, that client program needs to implement (show screens, perform related stuff). It looks like we have started flame war, but in general I wish I would have another solid source for RESTfull web services with practical usage flow, with magical flexibility that you are referring to. Meanwhile a lot of statements are too vague.

                  – Centurion
                  May 12 '14 at 6:43








                18




                18





                What do you mean by "it's mandatory to embed links annotated with link relation types which convey meanings.." ?

                – pjz
                Aug 17 '13 at 1:35





                What do you mean by "it's mandatory to embed links annotated with link relation types which convey meanings.." ?

                – pjz
                Aug 17 '13 at 1:35




                113




                113





                "Clients are required to know procedure names" - that's not argument because with REST this name is hardcoded into the URI instead of passing as parameter. Otherwise server won't know which method it should perform.

                – Centurion
                May 8 '14 at 6:59





                "Clients are required to know procedure names" - that's not argument because with REST this name is hardcoded into the URI instead of passing as parameter. Otherwise server won't know which method it should perform.

                – Centurion
                May 8 '14 at 6:59




                39




                39





                "It's not that easy to change procedure signatures ... on server side without breaking client implementations", this also is debatable. Both REST and JSON-RPC are not SOAP and don't have WSDL that describes existing web services and their types so that could be used for dynamic change at client side. So, either way if you change web service you have to change the client. Otherwise you need to go with SOAP.

                – Centurion
                May 8 '14 at 7:04







                "It's not that easy to change procedure signatures ... on server side without breaking client implementations", this also is debatable. Both REST and JSON-RPC are not SOAP and don't have WSDL that describes existing web services and their types so that could be used for dynamic change at client side. So, either way if you change web service you have to change the client. Otherwise you need to go with SOAP.

                – Centurion
                May 8 '14 at 7:04






                59




                59





                I have coded dosen of apps and yet didn't see any flexible web services. If you change backend and web services than the client always needs to be refactored / updated to fit new requirements. And I have mentioned SOAP and because it has something that gives flexibility, like WSDL, so you can automate something and have more flexibility because you can get info about result set, datatypes and available web services. REST and others don't have that at all. So nor REST, nor JSON-RPC, nor other web service type will give you magic that would eliminate the need for manual client updating.

                – Centurion
                May 11 '14 at 18:54







                I have coded dosen of apps and yet didn't see any flexible web services. If you change backend and web services than the client always needs to be refactored / updated to fit new requirements. And I have mentioned SOAP and because it has something that gives flexibility, like WSDL, so you can automate something and have more flexibility because you can get info about result set, datatypes and available web services. REST and others don't have that at all. So nor REST, nor JSON-RPC, nor other web service type will give you magic that would eliminate the need for manual client updating.

                – Centurion
                May 11 '14 at 18:54






                12




                12





                For me, my current team and previous teams, RESTful web services are for CRUD type applications. Regarding "Do we rewrite browsers each time when something changes on server?" - no, because browsers are just HTTP executors, they have nothing to do with business logic, that client program needs to implement (show screens, perform related stuff). It looks like we have started flame war, but in general I wish I would have another solid source for RESTfull web services with practical usage flow, with magical flexibility that you are referring to. Meanwhile a lot of statements are too vague.

                – Centurion
                May 12 '14 at 6:43





                For me, my current team and previous teams, RESTful web services are for CRUD type applications. Regarding "Do we rewrite browsers each time when something changes on server?" - no, because browsers are just HTTP executors, they have nothing to do with business logic, that client program needs to implement (show screens, perform related stuff). It looks like we have started flame war, but in general I wish I would have another solid source for RESTfull web services with practical usage flow, with magical flexibility that you are referring to. Meanwhile a lot of statements are too vague.

                – Centurion
                May 12 '14 at 6:43













                151














                I have explored the issue in some detail and decided that pure REST is way too limiting, and RPC is best, even though most of my apps are CRUD apps. If you stick to REST, you eventually are going to be scratching your head wondering how you can easily add another needed method to your API for some special purpose. In many cases, the only way to do that with REST is to create another controller for it, which may unduly complicate your program.



                If you decide on RPC, the only difference is that you are explicitly specifying the verb as part of the URI, which is clear, consistent, less buggy, and really no trouble. Especially if you create an app that goes way beyond simple CRUD, RPC is the only way to go. I have another issue with RESTful purists: HTTP POST, GET, PUT, DELETE have definite meanings in HTTP which have been subverted by REST into meaning other things, simply because they fit most of the time - but not all of the time.



                In programming, I have long ago found that trying to use one thing to mean two things is going to come around sometime and bite you. I like to have the ability to use POST for just about every action, because it provides the freedom to send and receive data as your method needs to do. You can't fit the whole world into CRUD.






                share|improve this answer





















                • 28





                  This answer shows the all-too usual misconception of what REST actually is. REST is definitely not just a mapping of CRUD to HTTP methods. The idea that it is a problem to "add another method" clearly indicates that REST is misunderstood as RPC over HTTP, which it is not at all. Try reading Roy Fieldings blog or his dissertation - Google will help you find it - you are not describing REST at all in your answer.

                  – nepdev
                  Jan 23 '15 at 20:55






                • 62





                  I am a very practical person. All descriptions of REST that I have read clearly start with a mapping of CRUD to HTTP methods. More is allowed to be added theoretically, but in practicality, not. As an example, I recently wanted to implement PATCH for Android devices, but found that Android does not allow PATCH, so I used POST with an explicitly defined action to that effect in the URI. Basically, pure REST won't do the jobs that I require, so I use what works.

                  – Bruce Patin
                  Jan 25 '15 at 2:26






                • 4





                  So @BrucePatin, in your version "REST" you have a controller with four public methods that map 1 to 1 with GET|PUT|POST|DELETE? Some frameworks do that but that is not REST. HTTP verbs make vague abstract assertions about the semantics of a given request. You have to map your end points into those classes appropriately. GET could map to many different end points, so could the others. There is in fact no reason you can't implement REST-ful JSON-RPC over HTTP.

                  – spinkus
                  Mar 9 '15 at 21:18








                • 4





                  There is a very good reason. I might want several dozen actions, and have already run into a common use (Android) that does not even support PATCH. That kills it cold. I would rather be consistent than have to deal with several exceptions to the rule. In general, I will now only use GET, POST and DELETE. PUT does not allow for the feedback I would want on an update operation. I am using POST for almost everything. Regarding caching, it has caused many problems by returning old data. Regarding putting parameters in POST, ASP.NET already handles it automatically from automatic JSON objects.

                  – Bruce Patin
                  Mar 11 '15 at 0:03






                • 18





                  I believe the bickering over what REST really is only underscores your comments and highlights a major shortcoming of REST. Conceptually it's difficult to find two people who completely agree on what RESTful is. Anyway it doesn't matter because no service should go undocumented RPC or REST. If it's documented then the developer who uses it should have no problems.

                  – Agile Jedi
                  May 22 '15 at 22:35
















                151














                I have explored the issue in some detail and decided that pure REST is way too limiting, and RPC is best, even though most of my apps are CRUD apps. If you stick to REST, you eventually are going to be scratching your head wondering how you can easily add another needed method to your API for some special purpose. In many cases, the only way to do that with REST is to create another controller for it, which may unduly complicate your program.



                If you decide on RPC, the only difference is that you are explicitly specifying the verb as part of the URI, which is clear, consistent, less buggy, and really no trouble. Especially if you create an app that goes way beyond simple CRUD, RPC is the only way to go. I have another issue with RESTful purists: HTTP POST, GET, PUT, DELETE have definite meanings in HTTP which have been subverted by REST into meaning other things, simply because they fit most of the time - but not all of the time.



                In programming, I have long ago found that trying to use one thing to mean two things is going to come around sometime and bite you. I like to have the ability to use POST for just about every action, because it provides the freedom to send and receive data as your method needs to do. You can't fit the whole world into CRUD.






                share|improve this answer





















                • 28





                  This answer shows the all-too usual misconception of what REST actually is. REST is definitely not just a mapping of CRUD to HTTP methods. The idea that it is a problem to "add another method" clearly indicates that REST is misunderstood as RPC over HTTP, which it is not at all. Try reading Roy Fieldings blog or his dissertation - Google will help you find it - you are not describing REST at all in your answer.

                  – nepdev
                  Jan 23 '15 at 20:55






                • 62





                  I am a very practical person. All descriptions of REST that I have read clearly start with a mapping of CRUD to HTTP methods. More is allowed to be added theoretically, but in practicality, not. As an example, I recently wanted to implement PATCH for Android devices, but found that Android does not allow PATCH, so I used POST with an explicitly defined action to that effect in the URI. Basically, pure REST won't do the jobs that I require, so I use what works.

                  – Bruce Patin
                  Jan 25 '15 at 2:26






                • 4





                  So @BrucePatin, in your version "REST" you have a controller with four public methods that map 1 to 1 with GET|PUT|POST|DELETE? Some frameworks do that but that is not REST. HTTP verbs make vague abstract assertions about the semantics of a given request. You have to map your end points into those classes appropriately. GET could map to many different end points, so could the others. There is in fact no reason you can't implement REST-ful JSON-RPC over HTTP.

                  – spinkus
                  Mar 9 '15 at 21:18








                • 4





                  There is a very good reason. I might want several dozen actions, and have already run into a common use (Android) that does not even support PATCH. That kills it cold. I would rather be consistent than have to deal with several exceptions to the rule. In general, I will now only use GET, POST and DELETE. PUT does not allow for the feedback I would want on an update operation. I am using POST for almost everything. Regarding caching, it has caused many problems by returning old data. Regarding putting parameters in POST, ASP.NET already handles it automatically from automatic JSON objects.

                  – Bruce Patin
                  Mar 11 '15 at 0:03






                • 18





                  I believe the bickering over what REST really is only underscores your comments and highlights a major shortcoming of REST. Conceptually it's difficult to find two people who completely agree on what RESTful is. Anyway it doesn't matter because no service should go undocumented RPC or REST. If it's documented then the developer who uses it should have no problems.

                  – Agile Jedi
                  May 22 '15 at 22:35














                151












                151








                151







                I have explored the issue in some detail and decided that pure REST is way too limiting, and RPC is best, even though most of my apps are CRUD apps. If you stick to REST, you eventually are going to be scratching your head wondering how you can easily add another needed method to your API for some special purpose. In many cases, the only way to do that with REST is to create another controller for it, which may unduly complicate your program.



                If you decide on RPC, the only difference is that you are explicitly specifying the verb as part of the URI, which is clear, consistent, less buggy, and really no trouble. Especially if you create an app that goes way beyond simple CRUD, RPC is the only way to go. I have another issue with RESTful purists: HTTP POST, GET, PUT, DELETE have definite meanings in HTTP which have been subverted by REST into meaning other things, simply because they fit most of the time - but not all of the time.



                In programming, I have long ago found that trying to use one thing to mean two things is going to come around sometime and bite you. I like to have the ability to use POST for just about every action, because it provides the freedom to send and receive data as your method needs to do. You can't fit the whole world into CRUD.






                share|improve this answer















                I have explored the issue in some detail and decided that pure REST is way too limiting, and RPC is best, even though most of my apps are CRUD apps. If you stick to REST, you eventually are going to be scratching your head wondering how you can easily add another needed method to your API for some special purpose. In many cases, the only way to do that with REST is to create another controller for it, which may unduly complicate your program.



                If you decide on RPC, the only difference is that you are explicitly specifying the verb as part of the URI, which is clear, consistent, less buggy, and really no trouble. Especially if you create an app that goes way beyond simple CRUD, RPC is the only way to go. I have another issue with RESTful purists: HTTP POST, GET, PUT, DELETE have definite meanings in HTTP which have been subverted by REST into meaning other things, simply because they fit most of the time - but not all of the time.



                In programming, I have long ago found that trying to use one thing to mean two things is going to come around sometime and bite you. I like to have the ability to use POST for just about every action, because it provides the freedom to send and receive data as your method needs to do. You can't fit the whole world into CRUD.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 14 '15 at 13:01









                Hossein Narimani Rad

                20.9k116296




                20.9k116296










                answered Dec 17 '13 at 20:27









                Bruce PatinBruce Patin

                1,707177




                1,707177








                • 28





                  This answer shows the all-too usual misconception of what REST actually is. REST is definitely not just a mapping of CRUD to HTTP methods. The idea that it is a problem to "add another method" clearly indicates that REST is misunderstood as RPC over HTTP, which it is not at all. Try reading Roy Fieldings blog or his dissertation - Google will help you find it - you are not describing REST at all in your answer.

                  – nepdev
                  Jan 23 '15 at 20:55






                • 62





                  I am a very practical person. All descriptions of REST that I have read clearly start with a mapping of CRUD to HTTP methods. More is allowed to be added theoretically, but in practicality, not. As an example, I recently wanted to implement PATCH for Android devices, but found that Android does not allow PATCH, so I used POST with an explicitly defined action to that effect in the URI. Basically, pure REST won't do the jobs that I require, so I use what works.

                  – Bruce Patin
                  Jan 25 '15 at 2:26






                • 4





                  So @BrucePatin, in your version "REST" you have a controller with four public methods that map 1 to 1 with GET|PUT|POST|DELETE? Some frameworks do that but that is not REST. HTTP verbs make vague abstract assertions about the semantics of a given request. You have to map your end points into those classes appropriately. GET could map to many different end points, so could the others. There is in fact no reason you can't implement REST-ful JSON-RPC over HTTP.

                  – spinkus
                  Mar 9 '15 at 21:18








                • 4





                  There is a very good reason. I might want several dozen actions, and have already run into a common use (Android) that does not even support PATCH. That kills it cold. I would rather be consistent than have to deal with several exceptions to the rule. In general, I will now only use GET, POST and DELETE. PUT does not allow for the feedback I would want on an update operation. I am using POST for almost everything. Regarding caching, it has caused many problems by returning old data. Regarding putting parameters in POST, ASP.NET already handles it automatically from automatic JSON objects.

                  – Bruce Patin
                  Mar 11 '15 at 0:03






                • 18





                  I believe the bickering over what REST really is only underscores your comments and highlights a major shortcoming of REST. Conceptually it's difficult to find two people who completely agree on what RESTful is. Anyway it doesn't matter because no service should go undocumented RPC or REST. If it's documented then the developer who uses it should have no problems.

                  – Agile Jedi
                  May 22 '15 at 22:35














                • 28





                  This answer shows the all-too usual misconception of what REST actually is. REST is definitely not just a mapping of CRUD to HTTP methods. The idea that it is a problem to "add another method" clearly indicates that REST is misunderstood as RPC over HTTP, which it is not at all. Try reading Roy Fieldings blog or his dissertation - Google will help you find it - you are not describing REST at all in your answer.

                  – nepdev
                  Jan 23 '15 at 20:55






                • 62





                  I am a very practical person. All descriptions of REST that I have read clearly start with a mapping of CRUD to HTTP methods. More is allowed to be added theoretically, but in practicality, not. As an example, I recently wanted to implement PATCH for Android devices, but found that Android does not allow PATCH, so I used POST with an explicitly defined action to that effect in the URI. Basically, pure REST won't do the jobs that I require, so I use what works.

                  – Bruce Patin
                  Jan 25 '15 at 2:26






                • 4





                  So @BrucePatin, in your version "REST" you have a controller with four public methods that map 1 to 1 with GET|PUT|POST|DELETE? Some frameworks do that but that is not REST. HTTP verbs make vague abstract assertions about the semantics of a given request. You have to map your end points into those classes appropriately. GET could map to many different end points, so could the others. There is in fact no reason you can't implement REST-ful JSON-RPC over HTTP.

                  – spinkus
                  Mar 9 '15 at 21:18








                • 4





                  There is a very good reason. I might want several dozen actions, and have already run into a common use (Android) that does not even support PATCH. That kills it cold. I would rather be consistent than have to deal with several exceptions to the rule. In general, I will now only use GET, POST and DELETE. PUT does not allow for the feedback I would want on an update operation. I am using POST for almost everything. Regarding caching, it has caused many problems by returning old data. Regarding putting parameters in POST, ASP.NET already handles it automatically from automatic JSON objects.

                  – Bruce Patin
                  Mar 11 '15 at 0:03






                • 18





                  I believe the bickering over what REST really is only underscores your comments and highlights a major shortcoming of REST. Conceptually it's difficult to find two people who completely agree on what RESTful is. Anyway it doesn't matter because no service should go undocumented RPC or REST. If it's documented then the developer who uses it should have no problems.

                  – Agile Jedi
                  May 22 '15 at 22:35








                28




                28





                This answer shows the all-too usual misconception of what REST actually is. REST is definitely not just a mapping of CRUD to HTTP methods. The idea that it is a problem to "add another method" clearly indicates that REST is misunderstood as RPC over HTTP, which it is not at all. Try reading Roy Fieldings blog or his dissertation - Google will help you find it - you are not describing REST at all in your answer.

                – nepdev
                Jan 23 '15 at 20:55





                This answer shows the all-too usual misconception of what REST actually is. REST is definitely not just a mapping of CRUD to HTTP methods. The idea that it is a problem to "add another method" clearly indicates that REST is misunderstood as RPC over HTTP, which it is not at all. Try reading Roy Fieldings blog or his dissertation - Google will help you find it - you are not describing REST at all in your answer.

                – nepdev
                Jan 23 '15 at 20:55




                62




                62





                I am a very practical person. All descriptions of REST that I have read clearly start with a mapping of CRUD to HTTP methods. More is allowed to be added theoretically, but in practicality, not. As an example, I recently wanted to implement PATCH for Android devices, but found that Android does not allow PATCH, so I used POST with an explicitly defined action to that effect in the URI. Basically, pure REST won't do the jobs that I require, so I use what works.

                – Bruce Patin
                Jan 25 '15 at 2:26





                I am a very practical person. All descriptions of REST that I have read clearly start with a mapping of CRUD to HTTP methods. More is allowed to be added theoretically, but in practicality, not. As an example, I recently wanted to implement PATCH for Android devices, but found that Android does not allow PATCH, so I used POST with an explicitly defined action to that effect in the URI. Basically, pure REST won't do the jobs that I require, so I use what works.

                – Bruce Patin
                Jan 25 '15 at 2:26




                4




                4





                So @BrucePatin, in your version "REST" you have a controller with four public methods that map 1 to 1 with GET|PUT|POST|DELETE? Some frameworks do that but that is not REST. HTTP verbs make vague abstract assertions about the semantics of a given request. You have to map your end points into those classes appropriately. GET could map to many different end points, so could the others. There is in fact no reason you can't implement REST-ful JSON-RPC over HTTP.

                – spinkus
                Mar 9 '15 at 21:18







                So @BrucePatin, in your version "REST" you have a controller with four public methods that map 1 to 1 with GET|PUT|POST|DELETE? Some frameworks do that but that is not REST. HTTP verbs make vague abstract assertions about the semantics of a given request. You have to map your end points into those classes appropriately. GET could map to many different end points, so could the others. There is in fact no reason you can't implement REST-ful JSON-RPC over HTTP.

                – spinkus
                Mar 9 '15 at 21:18






                4




                4





                There is a very good reason. I might want several dozen actions, and have already run into a common use (Android) that does not even support PATCH. That kills it cold. I would rather be consistent than have to deal with several exceptions to the rule. In general, I will now only use GET, POST and DELETE. PUT does not allow for the feedback I would want on an update operation. I am using POST for almost everything. Regarding caching, it has caused many problems by returning old data. Regarding putting parameters in POST, ASP.NET already handles it automatically from automatic JSON objects.

                – Bruce Patin
                Mar 11 '15 at 0:03





                There is a very good reason. I might want several dozen actions, and have already run into a common use (Android) that does not even support PATCH. That kills it cold. I would rather be consistent than have to deal with several exceptions to the rule. In general, I will now only use GET, POST and DELETE. PUT does not allow for the feedback I would want on an update operation. I am using POST for almost everything. Regarding caching, it has caused many problems by returning old data. Regarding putting parameters in POST, ASP.NET already handles it automatically from automatic JSON objects.

                – Bruce Patin
                Mar 11 '15 at 0:03




                18




                18





                I believe the bickering over what REST really is only underscores your comments and highlights a major shortcoming of REST. Conceptually it's difficult to find two people who completely agree on what RESTful is. Anyway it doesn't matter because no service should go undocumented RPC or REST. If it's documented then the developer who uses it should have no problems.

                – Agile Jedi
                May 22 '15 at 22:35





                I believe the bickering over what REST really is only underscores your comments and highlights a major shortcoming of REST. Conceptually it's difficult to find two people who completely agree on what RESTful is. Anyway it doesn't matter because no service should go undocumented RPC or REST. If it's documented then the developer who uses it should have no problems.

                – Agile Jedi
                May 22 '15 at 22:35











                28














                First, HTTP-REST is a "representational state transfer" architecture. This implies a lot of interesting things:




                • Your API will be stateless and therefore much easier to design (it's really easy to forget a transition in a complex automaton), and to integrate with independent software parts.

                • You will be lead to design read methods as safe ones, which will be easy to cache, and to integrate.

                • You will be lead to design write methods as idempotent ones, which will deal much better with timeouts.


                Second, HTTP-REST is fully compliant with HTTP (see "safe" and "idempotent" in the previous part), therefore you will be able to reuse HTTP libraries (existing for every existing language) and HTTP reverse proxies, which will give you the ability to implement advanced features (cache, authentication, compression, redirection, rewriting, logging, etc.) with zero line of code.



                Last but not least, using HTTP as an RPC protocol is a huge error according to the designer of HTTP 1.1 (and inventor of REST): http://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm#sec_6_5_2






                share|improve this answer



















                • 1





                  +1 for the authoritative, guy-who-should-know reference.... It's hard to argue for RPC over HTTP after that, without acknowledging it as a hack/work-around....

                  – RJB
                  Mar 23 '15 at 18:12






                • 9





                  You just referenced something from 2000. It's more a philosophical argument for REST versus RPC. Semantically and applying an RPC pattern you can easily consider the URI to be the "procedure" and the encoded parameters to be ...well...the parameters. Either pattern would work just fine over HTTP. Same with SOAP, RAILS or any other number of patterns/protocols that have been overlayed onto HTTP. It doesn't matter as long as you offer a consistent API that doesn't break it's contract.

                  – Agile Jedi
                  May 15 '15 at 2:28











                • Aurélien, could you justify, why REST is easier to integrate with independent software parts? To me, regardless if you use RESTful API or RPC, the client software need to know the format your API talks.

                  – Alexey
                  May 2 '16 at 11:56






                • 1





                  @Alexey This argument was relative to statelessness. It is easier to integrate a coffee machine whose API is CREATE CUP, than another that would contain INSERT COIN, SELECT COFFEE, SELECT SUGAR, and START. In the second API, because it depends on the machine state, you have to be very careful with the sequence of procedure calls.

                  – Aurélien
                  May 2 '16 at 12:31






                • 1





                  HTTP as a RPC protocol is REST. So your incorrect interpretation is shockingly the other way around.

                  – Tiberiu-Ionuț Stan
                  Aug 13 '16 at 10:57
















                28














                First, HTTP-REST is a "representational state transfer" architecture. This implies a lot of interesting things:




                • Your API will be stateless and therefore much easier to design (it's really easy to forget a transition in a complex automaton), and to integrate with independent software parts.

                • You will be lead to design read methods as safe ones, which will be easy to cache, and to integrate.

                • You will be lead to design write methods as idempotent ones, which will deal much better with timeouts.


                Second, HTTP-REST is fully compliant with HTTP (see "safe" and "idempotent" in the previous part), therefore you will be able to reuse HTTP libraries (existing for every existing language) and HTTP reverse proxies, which will give you the ability to implement advanced features (cache, authentication, compression, redirection, rewriting, logging, etc.) with zero line of code.



                Last but not least, using HTTP as an RPC protocol is a huge error according to the designer of HTTP 1.1 (and inventor of REST): http://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm#sec_6_5_2






                share|improve this answer



















                • 1





                  +1 for the authoritative, guy-who-should-know reference.... It's hard to argue for RPC over HTTP after that, without acknowledging it as a hack/work-around....

                  – RJB
                  Mar 23 '15 at 18:12






                • 9





                  You just referenced something from 2000. It's more a philosophical argument for REST versus RPC. Semantically and applying an RPC pattern you can easily consider the URI to be the "procedure" and the encoded parameters to be ...well...the parameters. Either pattern would work just fine over HTTP. Same with SOAP, RAILS or any other number of patterns/protocols that have been overlayed onto HTTP. It doesn't matter as long as you offer a consistent API that doesn't break it's contract.

                  – Agile Jedi
                  May 15 '15 at 2:28











                • Aurélien, could you justify, why REST is easier to integrate with independent software parts? To me, regardless if you use RESTful API or RPC, the client software need to know the format your API talks.

                  – Alexey
                  May 2 '16 at 11:56






                • 1





                  @Alexey This argument was relative to statelessness. It is easier to integrate a coffee machine whose API is CREATE CUP, than another that would contain INSERT COIN, SELECT COFFEE, SELECT SUGAR, and START. In the second API, because it depends on the machine state, you have to be very careful with the sequence of procedure calls.

                  – Aurélien
                  May 2 '16 at 12:31






                • 1





                  HTTP as a RPC protocol is REST. So your incorrect interpretation is shockingly the other way around.

                  – Tiberiu-Ionuț Stan
                  Aug 13 '16 at 10:57














                28












                28








                28







                First, HTTP-REST is a "representational state transfer" architecture. This implies a lot of interesting things:




                • Your API will be stateless and therefore much easier to design (it's really easy to forget a transition in a complex automaton), and to integrate with independent software parts.

                • You will be lead to design read methods as safe ones, which will be easy to cache, and to integrate.

                • You will be lead to design write methods as idempotent ones, which will deal much better with timeouts.


                Second, HTTP-REST is fully compliant with HTTP (see "safe" and "idempotent" in the previous part), therefore you will be able to reuse HTTP libraries (existing for every existing language) and HTTP reverse proxies, which will give you the ability to implement advanced features (cache, authentication, compression, redirection, rewriting, logging, etc.) with zero line of code.



                Last but not least, using HTTP as an RPC protocol is a huge error according to the designer of HTTP 1.1 (and inventor of REST): http://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm#sec_6_5_2






                share|improve this answer













                First, HTTP-REST is a "representational state transfer" architecture. This implies a lot of interesting things:




                • Your API will be stateless and therefore much easier to design (it's really easy to forget a transition in a complex automaton), and to integrate with independent software parts.

                • You will be lead to design read methods as safe ones, which will be easy to cache, and to integrate.

                • You will be lead to design write methods as idempotent ones, which will deal much better with timeouts.


                Second, HTTP-REST is fully compliant with HTTP (see "safe" and "idempotent" in the previous part), therefore you will be able to reuse HTTP libraries (existing for every existing language) and HTTP reverse proxies, which will give you the ability to implement advanced features (cache, authentication, compression, redirection, rewriting, logging, etc.) with zero line of code.



                Last but not least, using HTTP as an RPC protocol is a huge error according to the designer of HTTP 1.1 (and inventor of REST): http://www.ics.uci.edu/~fielding/pubs/dissertation/evaluation.htm#sec_6_5_2







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 4 '13 at 10:52









                AurélienAurélien

                2,8561935




                2,8561935








                • 1





                  +1 for the authoritative, guy-who-should-know reference.... It's hard to argue for RPC over HTTP after that, without acknowledging it as a hack/work-around....

                  – RJB
                  Mar 23 '15 at 18:12






                • 9





                  You just referenced something from 2000. It's more a philosophical argument for REST versus RPC. Semantically and applying an RPC pattern you can easily consider the URI to be the "procedure" and the encoded parameters to be ...well...the parameters. Either pattern would work just fine over HTTP. Same with SOAP, RAILS or any other number of patterns/protocols that have been overlayed onto HTTP. It doesn't matter as long as you offer a consistent API that doesn't break it's contract.

                  – Agile Jedi
                  May 15 '15 at 2:28











                • Aurélien, could you justify, why REST is easier to integrate with independent software parts? To me, regardless if you use RESTful API or RPC, the client software need to know the format your API talks.

                  – Alexey
                  May 2 '16 at 11:56






                • 1





                  @Alexey This argument was relative to statelessness. It is easier to integrate a coffee machine whose API is CREATE CUP, than another that would contain INSERT COIN, SELECT COFFEE, SELECT SUGAR, and START. In the second API, because it depends on the machine state, you have to be very careful with the sequence of procedure calls.

                  – Aurélien
                  May 2 '16 at 12:31






                • 1





                  HTTP as a RPC protocol is REST. So your incorrect interpretation is shockingly the other way around.

                  – Tiberiu-Ionuț Stan
                  Aug 13 '16 at 10:57














                • 1





                  +1 for the authoritative, guy-who-should-know reference.... It's hard to argue for RPC over HTTP after that, without acknowledging it as a hack/work-around....

                  – RJB
                  Mar 23 '15 at 18:12






                • 9





                  You just referenced something from 2000. It's more a philosophical argument for REST versus RPC. Semantically and applying an RPC pattern you can easily consider the URI to be the "procedure" and the encoded parameters to be ...well...the parameters. Either pattern would work just fine over HTTP. Same with SOAP, RAILS or any other number of patterns/protocols that have been overlayed onto HTTP. It doesn't matter as long as you offer a consistent API that doesn't break it's contract.

                  – Agile Jedi
                  May 15 '15 at 2:28











                • Aurélien, could you justify, why REST is easier to integrate with independent software parts? To me, regardless if you use RESTful API or RPC, the client software need to know the format your API talks.

                  – Alexey
                  May 2 '16 at 11:56






                • 1





                  @Alexey This argument was relative to statelessness. It is easier to integrate a coffee machine whose API is CREATE CUP, than another that would contain INSERT COIN, SELECT COFFEE, SELECT SUGAR, and START. In the second API, because it depends on the machine state, you have to be very careful with the sequence of procedure calls.

                  – Aurélien
                  May 2 '16 at 12:31






                • 1





                  HTTP as a RPC protocol is REST. So your incorrect interpretation is shockingly the other way around.

                  – Tiberiu-Ionuț Stan
                  Aug 13 '16 at 10:57








                1




                1





                +1 for the authoritative, guy-who-should-know reference.... It's hard to argue for RPC over HTTP after that, without acknowledging it as a hack/work-around....

                – RJB
                Mar 23 '15 at 18:12





                +1 for the authoritative, guy-who-should-know reference.... It's hard to argue for RPC over HTTP after that, without acknowledging it as a hack/work-around....

                – RJB
                Mar 23 '15 at 18:12




                9




                9





                You just referenced something from 2000. It's more a philosophical argument for REST versus RPC. Semantically and applying an RPC pattern you can easily consider the URI to be the "procedure" and the encoded parameters to be ...well...the parameters. Either pattern would work just fine over HTTP. Same with SOAP, RAILS or any other number of patterns/protocols that have been overlayed onto HTTP. It doesn't matter as long as you offer a consistent API that doesn't break it's contract.

                – Agile Jedi
                May 15 '15 at 2:28





                You just referenced something from 2000. It's more a philosophical argument for REST versus RPC. Semantically and applying an RPC pattern you can easily consider the URI to be the "procedure" and the encoded parameters to be ...well...the parameters. Either pattern would work just fine over HTTP. Same with SOAP, RAILS or any other number of patterns/protocols that have been overlayed onto HTTP. It doesn't matter as long as you offer a consistent API that doesn't break it's contract.

                – Agile Jedi
                May 15 '15 at 2:28













                Aurélien, could you justify, why REST is easier to integrate with independent software parts? To me, regardless if you use RESTful API or RPC, the client software need to know the format your API talks.

                – Alexey
                May 2 '16 at 11:56





                Aurélien, could you justify, why REST is easier to integrate with independent software parts? To me, regardless if you use RESTful API or RPC, the client software need to know the format your API talks.

                – Alexey
                May 2 '16 at 11:56




                1




                1





                @Alexey This argument was relative to statelessness. It is easier to integrate a coffee machine whose API is CREATE CUP, than another that would contain INSERT COIN, SELECT COFFEE, SELECT SUGAR, and START. In the second API, because it depends on the machine state, you have to be very careful with the sequence of procedure calls.

                – Aurélien
                May 2 '16 at 12:31





                @Alexey This argument was relative to statelessness. It is easier to integrate a coffee machine whose API is CREATE CUP, than another that would contain INSERT COIN, SELECT COFFEE, SELECT SUGAR, and START. In the second API, because it depends on the machine state, you have to be very careful with the sequence of procedure calls.

                – Aurélien
                May 2 '16 at 12:31




                1




                1





                HTTP as a RPC protocol is REST. So your incorrect interpretation is shockingly the other way around.

                – Tiberiu-Ionuț Stan
                Aug 13 '16 at 10:57





                HTTP as a RPC protocol is REST. So your incorrect interpretation is shockingly the other way around.

                – Tiberiu-Ionuț Stan
                Aug 13 '16 at 10:57











                25














                Great answers - just wanted to clarify on a some of the comments. JSON-RPC is quick and easy to consume, but as mentioned resources and parameters are tightly coupled and it tends to rely on verbs (api/deleteUser, api/addUser) using GET/ POST where-as REST provides loosely coupled resources (api/users) that in a HTTP REST API relies on several HTTP methods (GET, POST, PUT, PATCH, DELETE). REST is slightly harder for inexperienced developers to implement, but the style has become fairly common place now and it provides much more flexibility in the long-run (giving your API a longer life).



                Along with not having tightly coupled resources, REST also allows you to avoid being committed to a single content-type- this means if your client needs to receive the data in XML, or JSON, or even YAML - if built into your system you could return any of those using the content-type/ accept headers.



                This lets you keep your API flexible enough to support new content types OR client requirements.



                But what truly separates REST from JSON-RPC is that it follows a series of carefully thought out constraints- ensuring architectural flexibility. These constraints include ensuring that the client and server are able to evolve independently of each other (you can make changes without messing up your client's application), the calls are stateless (state is represented through hypermedia), a uniform interface is provided for interactions, the API is developed on a layered system, and the response is cacheable by the client. There's also an optional constraint for providing code on demand.



                However, with all of this said - MOST APIs are not RESTful (according to Fielding) as they do not incorporate hypermedia (embedded hypertext links in the response that help navigate the API). Most APIs you will find out there are REST-like in that they follow most of the concepts of REST, but ignore this constraint. However, more and more APIs are implementing this and it is becoming more of a main-stream practice.



                This also gives you some flexibility as hypermedia driven APIs (such as Stormpath) direct the client to the URIs (meaning if something changes, in certain cases you can modify the URI without negative impact), where-as with RPC URIs are required to be static. With RPC, you will also need to extensively document these different URIs and explain how they work in relation to each other.



                In general, I would say REST is the way to go if you want to build an extensible, flexible API that will be long-lived. For that reason, I would say it's the route to go 99% of the time.



                Good luck,
                Mike






                share|improve this answer



















                • 2





                  it's not SLIGHTLY harder, but rather extremely more difficult. I've been trying to understand it for 4 months or so, and still don't have a good handle of how to write a service that doesn't devolve into a stateless RPC over http using json, And I'm still not convinced there's a real difference between "REST" and what I just said

                  – Austin_Anderson
                  Aug 2 '17 at 20:19
















                25














                Great answers - just wanted to clarify on a some of the comments. JSON-RPC is quick and easy to consume, but as mentioned resources and parameters are tightly coupled and it tends to rely on verbs (api/deleteUser, api/addUser) using GET/ POST where-as REST provides loosely coupled resources (api/users) that in a HTTP REST API relies on several HTTP methods (GET, POST, PUT, PATCH, DELETE). REST is slightly harder for inexperienced developers to implement, but the style has become fairly common place now and it provides much more flexibility in the long-run (giving your API a longer life).



                Along with not having tightly coupled resources, REST also allows you to avoid being committed to a single content-type- this means if your client needs to receive the data in XML, or JSON, or even YAML - if built into your system you could return any of those using the content-type/ accept headers.



                This lets you keep your API flexible enough to support new content types OR client requirements.



                But what truly separates REST from JSON-RPC is that it follows a series of carefully thought out constraints- ensuring architectural flexibility. These constraints include ensuring that the client and server are able to evolve independently of each other (you can make changes without messing up your client's application), the calls are stateless (state is represented through hypermedia), a uniform interface is provided for interactions, the API is developed on a layered system, and the response is cacheable by the client. There's also an optional constraint for providing code on demand.



                However, with all of this said - MOST APIs are not RESTful (according to Fielding) as they do not incorporate hypermedia (embedded hypertext links in the response that help navigate the API). Most APIs you will find out there are REST-like in that they follow most of the concepts of REST, but ignore this constraint. However, more and more APIs are implementing this and it is becoming more of a main-stream practice.



                This also gives you some flexibility as hypermedia driven APIs (such as Stormpath) direct the client to the URIs (meaning if something changes, in certain cases you can modify the URI without negative impact), where-as with RPC URIs are required to be static. With RPC, you will also need to extensively document these different URIs and explain how they work in relation to each other.



                In general, I would say REST is the way to go if you want to build an extensible, flexible API that will be long-lived. For that reason, I would say it's the route to go 99% of the time.



                Good luck,
                Mike






                share|improve this answer



















                • 2





                  it's not SLIGHTLY harder, but rather extremely more difficult. I've been trying to understand it for 4 months or so, and still don't have a good handle of how to write a service that doesn't devolve into a stateless RPC over http using json, And I'm still not convinced there's a real difference between "REST" and what I just said

                  – Austin_Anderson
                  Aug 2 '17 at 20:19














                25












                25








                25







                Great answers - just wanted to clarify on a some of the comments. JSON-RPC is quick and easy to consume, but as mentioned resources and parameters are tightly coupled and it tends to rely on verbs (api/deleteUser, api/addUser) using GET/ POST where-as REST provides loosely coupled resources (api/users) that in a HTTP REST API relies on several HTTP methods (GET, POST, PUT, PATCH, DELETE). REST is slightly harder for inexperienced developers to implement, but the style has become fairly common place now and it provides much more flexibility in the long-run (giving your API a longer life).



                Along with not having tightly coupled resources, REST also allows you to avoid being committed to a single content-type- this means if your client needs to receive the data in XML, or JSON, or even YAML - if built into your system you could return any of those using the content-type/ accept headers.



                This lets you keep your API flexible enough to support new content types OR client requirements.



                But what truly separates REST from JSON-RPC is that it follows a series of carefully thought out constraints- ensuring architectural flexibility. These constraints include ensuring that the client and server are able to evolve independently of each other (you can make changes without messing up your client's application), the calls are stateless (state is represented through hypermedia), a uniform interface is provided for interactions, the API is developed on a layered system, and the response is cacheable by the client. There's also an optional constraint for providing code on demand.



                However, with all of this said - MOST APIs are not RESTful (according to Fielding) as they do not incorporate hypermedia (embedded hypertext links in the response that help navigate the API). Most APIs you will find out there are REST-like in that they follow most of the concepts of REST, but ignore this constraint. However, more and more APIs are implementing this and it is becoming more of a main-stream practice.



                This also gives you some flexibility as hypermedia driven APIs (such as Stormpath) direct the client to the URIs (meaning if something changes, in certain cases you can modify the URI without negative impact), where-as with RPC URIs are required to be static. With RPC, you will also need to extensively document these different URIs and explain how they work in relation to each other.



                In general, I would say REST is the way to go if you want to build an extensible, flexible API that will be long-lived. For that reason, I would say it's the route to go 99% of the time.



                Good luck,
                Mike






                share|improve this answer













                Great answers - just wanted to clarify on a some of the comments. JSON-RPC is quick and easy to consume, but as mentioned resources and parameters are tightly coupled and it tends to rely on verbs (api/deleteUser, api/addUser) using GET/ POST where-as REST provides loosely coupled resources (api/users) that in a HTTP REST API relies on several HTTP methods (GET, POST, PUT, PATCH, DELETE). REST is slightly harder for inexperienced developers to implement, but the style has become fairly common place now and it provides much more flexibility in the long-run (giving your API a longer life).



                Along with not having tightly coupled resources, REST also allows you to avoid being committed to a single content-type- this means if your client needs to receive the data in XML, or JSON, or even YAML - if built into your system you could return any of those using the content-type/ accept headers.



                This lets you keep your API flexible enough to support new content types OR client requirements.



                But what truly separates REST from JSON-RPC is that it follows a series of carefully thought out constraints- ensuring architectural flexibility. These constraints include ensuring that the client and server are able to evolve independently of each other (you can make changes without messing up your client's application), the calls are stateless (state is represented through hypermedia), a uniform interface is provided for interactions, the API is developed on a layered system, and the response is cacheable by the client. There's also an optional constraint for providing code on demand.



                However, with all of this said - MOST APIs are not RESTful (according to Fielding) as they do not incorporate hypermedia (embedded hypertext links in the response that help navigate the API). Most APIs you will find out there are REST-like in that they follow most of the concepts of REST, but ignore this constraint. However, more and more APIs are implementing this and it is becoming more of a main-stream practice.



                This also gives you some flexibility as hypermedia driven APIs (such as Stormpath) direct the client to the URIs (meaning if something changes, in certain cases you can modify the URI without negative impact), where-as with RPC URIs are required to be static. With RPC, you will also need to extensively document these different URIs and explain how they work in relation to each other.



                In general, I would say REST is the way to go if you want to build an extensible, flexible API that will be long-lived. For that reason, I would say it's the route to go 99% of the time.



                Good luck,
                Mike







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 1 '15 at 7:47









                Mike StoweMike Stowe

                42744




                42744








                • 2





                  it's not SLIGHTLY harder, but rather extremely more difficult. I've been trying to understand it for 4 months or so, and still don't have a good handle of how to write a service that doesn't devolve into a stateless RPC over http using json, And I'm still not convinced there's a real difference between "REST" and what I just said

                  – Austin_Anderson
                  Aug 2 '17 at 20:19














                • 2





                  it's not SLIGHTLY harder, but rather extremely more difficult. I've been trying to understand it for 4 months or so, and still don't have a good handle of how to write a service that doesn't devolve into a stateless RPC over http using json, And I'm still not convinced there's a real difference between "REST" and what I just said

                  – Austin_Anderson
                  Aug 2 '17 at 20:19








                2




                2





                it's not SLIGHTLY harder, but rather extremely more difficult. I've been trying to understand it for 4 months or so, and still don't have a good handle of how to write a service that doesn't devolve into a stateless RPC over http using json, And I'm still not convinced there's a real difference between "REST" and what I just said

                – Austin_Anderson
                Aug 2 '17 at 20:19





                it's not SLIGHTLY harder, but rather extremely more difficult. I've been trying to understand it for 4 months or so, and still don't have a good handle of how to write a service that doesn't devolve into a stateless RPC over http using json, And I'm still not convinced there's a real difference between "REST" and what I just said

                – Austin_Anderson
                Aug 2 '17 at 20:19











                17














                If your service works fine with only models and the GET/POST/PUT/DELETE pattern, use pure REST.



                I agree that HTTP is originally designed for stateless applications.



                But for modern, more complex (!) real-time (web) applications where you will want to use Websockets (which often imply statefulness), why not use both? JSON-RPC over Websockets is very light so you have the following benefits:




                • Instant updates on every client (define your own server-to-client RPC call for updating the models)

                • Easy to add complexity (try to make an Etherpad clone with only REST)

                • If you do it right (add RPC only as an extra for real-time), most is still usable with only REST (except if the main feature is a chat or something)


                As you are only designing the server side API, start with defining REST models and later add JSON-RPC support as needed, keeping the number of RPC calls to a minimum.



                (and sorry for parentheses overuse)






                share|improve this answer




























                  17














                  If your service works fine with only models and the GET/POST/PUT/DELETE pattern, use pure REST.



                  I agree that HTTP is originally designed for stateless applications.



                  But for modern, more complex (!) real-time (web) applications where you will want to use Websockets (which often imply statefulness), why not use both? JSON-RPC over Websockets is very light so you have the following benefits:




                  • Instant updates on every client (define your own server-to-client RPC call for updating the models)

                  • Easy to add complexity (try to make an Etherpad clone with only REST)

                  • If you do it right (add RPC only as an extra for real-time), most is still usable with only REST (except if the main feature is a chat or something)


                  As you are only designing the server side API, start with defining REST models and later add JSON-RPC support as needed, keeping the number of RPC calls to a minimum.



                  (and sorry for parentheses overuse)






                  share|improve this answer


























                    17












                    17








                    17







                    If your service works fine with only models and the GET/POST/PUT/DELETE pattern, use pure REST.



                    I agree that HTTP is originally designed for stateless applications.



                    But for modern, more complex (!) real-time (web) applications where you will want to use Websockets (which often imply statefulness), why not use both? JSON-RPC over Websockets is very light so you have the following benefits:




                    • Instant updates on every client (define your own server-to-client RPC call for updating the models)

                    • Easy to add complexity (try to make an Etherpad clone with only REST)

                    • If you do it right (add RPC only as an extra for real-time), most is still usable with only REST (except if the main feature is a chat or something)


                    As you are only designing the server side API, start with defining REST models and later add JSON-RPC support as needed, keeping the number of RPC calls to a minimum.



                    (and sorry for parentheses overuse)






                    share|improve this answer













                    If your service works fine with only models and the GET/POST/PUT/DELETE pattern, use pure REST.



                    I agree that HTTP is originally designed for stateless applications.



                    But for modern, more complex (!) real-time (web) applications where you will want to use Websockets (which often imply statefulness), why not use both? JSON-RPC over Websockets is very light so you have the following benefits:




                    • Instant updates on every client (define your own server-to-client RPC call for updating the models)

                    • Easy to add complexity (try to make an Etherpad clone with only REST)

                    • If you do it right (add RPC only as an extra for real-time), most is still usable with only REST (except if the main feature is a chat or something)


                    As you are only designing the server side API, start with defining REST models and later add JSON-RPC support as needed, keeping the number of RPC calls to a minimum.



                    (and sorry for parentheses overuse)







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 29 '15 at 12:08









                    floflo

                    387614




                    387614























                        15














                        IMO, the key point is the action vs resource orientation. REST is resource-oriented and fits well for CRUD operations and given its known semantics provides some predictability to a first user, but when implemented from methods or procedures forces you to provide an artificial translation to the resource centered world. On the other hand RPC suits perfectly to action-oriented APIs, where you expose services, not CRUD-able resource sets.



                        No doubt REST is more popular, this definitely adds some points if you want to expose the API to a third party.



                        If not (for example in case of creating an AJAX front-end in a SPA), my choice is RPC. In particular JSON-RPC, combined with JSON Schema as description language, and transported over HTTP or Websockets depending on the use case.



                        JSON-RPC is a simple and elegant specification that defines request and response JSON payloads to be used in synchronous or asynchronous RPC.



                        JSON Schema is draft specification defining a JSON based format aimed at describing JSON data. By describing your service input and output messages using JSON Schema you can have an arbitrary complexity in the message structure without compromising usability, and service integration can be automatized.



                        The choice of transport protocol (HTTP vs websockets) depends on different factors, being the most important whether you need HTTP features (caching, revalidation, safety, idempotence, content-type, multipart, ...) or whether you application needs to interchange messages at high frecuencies.



                        Until now it is very much my personal opinion on the issue, but now something that can be really helpful for those Java developers reading these lines, the framework I have been working on during the last year, born from the same question you are wondering now:



                        http://rpc.brutusin.org



                        You can see a live demo here, showing the built-in repository browser for functional testing (thanks JSON Schema) and a series of example services:



                        http://demo.rpc.brutusin.org



                        Hope it helps mate!



                        Nacho






                        share|improve this answer


























                        • It's great to find a kindred spirit! I'm working on something similar over here: github.com/dnault/therapi-json-rpc

                          – dnault
                          Mar 17 '16 at 22:06













                        • :) I'll look into it

                          – idelvall
                          Mar 18 '16 at 8:29











                        • Agree with this. REST works well for CRUD APIs since you have the obvious POST/GET/PUT/DELETE [PoGPuD? ;)] mapping. However, if your API doesn't fit comfortably in to those verbs, JSON-RPC may be a good option since the verbs are just going to confuse matters. So yeah, who's using it and why is a big factor.

                          – Algy Taylor
                          Dec 9 '16 at 13:07








                        • 1





                          Exactly - REST is the kingdom of the nouns, JSON-RPC is verbs.

                          – Robert Grant
                          Jan 2 '17 at 9:09
















                        15














                        IMO, the key point is the action vs resource orientation. REST is resource-oriented and fits well for CRUD operations and given its known semantics provides some predictability to a first user, but when implemented from methods or procedures forces you to provide an artificial translation to the resource centered world. On the other hand RPC suits perfectly to action-oriented APIs, where you expose services, not CRUD-able resource sets.



                        No doubt REST is more popular, this definitely adds some points if you want to expose the API to a third party.



                        If not (for example in case of creating an AJAX front-end in a SPA), my choice is RPC. In particular JSON-RPC, combined with JSON Schema as description language, and transported over HTTP or Websockets depending on the use case.



                        JSON-RPC is a simple and elegant specification that defines request and response JSON payloads to be used in synchronous or asynchronous RPC.



                        JSON Schema is draft specification defining a JSON based format aimed at describing JSON data. By describing your service input and output messages using JSON Schema you can have an arbitrary complexity in the message structure without compromising usability, and service integration can be automatized.



                        The choice of transport protocol (HTTP vs websockets) depends on different factors, being the most important whether you need HTTP features (caching, revalidation, safety, idempotence, content-type, multipart, ...) or whether you application needs to interchange messages at high frecuencies.



                        Until now it is very much my personal opinion on the issue, but now something that can be really helpful for those Java developers reading these lines, the framework I have been working on during the last year, born from the same question you are wondering now:



                        http://rpc.brutusin.org



                        You can see a live demo here, showing the built-in repository browser for functional testing (thanks JSON Schema) and a series of example services:



                        http://demo.rpc.brutusin.org



                        Hope it helps mate!



                        Nacho






                        share|improve this answer


























                        • It's great to find a kindred spirit! I'm working on something similar over here: github.com/dnault/therapi-json-rpc

                          – dnault
                          Mar 17 '16 at 22:06













                        • :) I'll look into it

                          – idelvall
                          Mar 18 '16 at 8:29











                        • Agree with this. REST works well for CRUD APIs since you have the obvious POST/GET/PUT/DELETE [PoGPuD? ;)] mapping. However, if your API doesn't fit comfortably in to those verbs, JSON-RPC may be a good option since the verbs are just going to confuse matters. So yeah, who's using it and why is a big factor.

                          – Algy Taylor
                          Dec 9 '16 at 13:07








                        • 1





                          Exactly - REST is the kingdom of the nouns, JSON-RPC is verbs.

                          – Robert Grant
                          Jan 2 '17 at 9:09














                        15












                        15








                        15







                        IMO, the key point is the action vs resource orientation. REST is resource-oriented and fits well for CRUD operations and given its known semantics provides some predictability to a first user, but when implemented from methods or procedures forces you to provide an artificial translation to the resource centered world. On the other hand RPC suits perfectly to action-oriented APIs, where you expose services, not CRUD-able resource sets.



                        No doubt REST is more popular, this definitely adds some points if you want to expose the API to a third party.



                        If not (for example in case of creating an AJAX front-end in a SPA), my choice is RPC. In particular JSON-RPC, combined with JSON Schema as description language, and transported over HTTP or Websockets depending on the use case.



                        JSON-RPC is a simple and elegant specification that defines request and response JSON payloads to be used in synchronous or asynchronous RPC.



                        JSON Schema is draft specification defining a JSON based format aimed at describing JSON data. By describing your service input and output messages using JSON Schema you can have an arbitrary complexity in the message structure without compromising usability, and service integration can be automatized.



                        The choice of transport protocol (HTTP vs websockets) depends on different factors, being the most important whether you need HTTP features (caching, revalidation, safety, idempotence, content-type, multipart, ...) or whether you application needs to interchange messages at high frecuencies.



                        Until now it is very much my personal opinion on the issue, but now something that can be really helpful for those Java developers reading these lines, the framework I have been working on during the last year, born from the same question you are wondering now:



                        http://rpc.brutusin.org



                        You can see a live demo here, showing the built-in repository browser for functional testing (thanks JSON Schema) and a series of example services:



                        http://demo.rpc.brutusin.org



                        Hope it helps mate!



                        Nacho






                        share|improve this answer















                        IMO, the key point is the action vs resource orientation. REST is resource-oriented and fits well for CRUD operations and given its known semantics provides some predictability to a first user, but when implemented from methods or procedures forces you to provide an artificial translation to the resource centered world. On the other hand RPC suits perfectly to action-oriented APIs, where you expose services, not CRUD-able resource sets.



                        No doubt REST is more popular, this definitely adds some points if you want to expose the API to a third party.



                        If not (for example in case of creating an AJAX front-end in a SPA), my choice is RPC. In particular JSON-RPC, combined with JSON Schema as description language, and transported over HTTP or Websockets depending on the use case.



                        JSON-RPC is a simple and elegant specification that defines request and response JSON payloads to be used in synchronous or asynchronous RPC.



                        JSON Schema is draft specification defining a JSON based format aimed at describing JSON data. By describing your service input and output messages using JSON Schema you can have an arbitrary complexity in the message structure without compromising usability, and service integration can be automatized.



                        The choice of transport protocol (HTTP vs websockets) depends on different factors, being the most important whether you need HTTP features (caching, revalidation, safety, idempotence, content-type, multipart, ...) or whether you application needs to interchange messages at high frecuencies.



                        Until now it is very much my personal opinion on the issue, but now something that can be really helpful for those Java developers reading these lines, the framework I have been working on during the last year, born from the same question you are wondering now:



                        http://rpc.brutusin.org



                        You can see a live demo here, showing the built-in repository browser for functional testing (thanks JSON Schema) and a series of example services:



                        http://demo.rpc.brutusin.org



                        Hope it helps mate!



                        Nacho







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Sep 27 '16 at 13:49

























                        answered Jan 21 '16 at 23:30









                        idelvallidelvall

                        1,0701021




                        1,0701021













                        • It's great to find a kindred spirit! I'm working on something similar over here: github.com/dnault/therapi-json-rpc

                          – dnault
                          Mar 17 '16 at 22:06













                        • :) I'll look into it

                          – idelvall
                          Mar 18 '16 at 8:29











                        • Agree with this. REST works well for CRUD APIs since you have the obvious POST/GET/PUT/DELETE [PoGPuD? ;)] mapping. However, if your API doesn't fit comfortably in to those verbs, JSON-RPC may be a good option since the verbs are just going to confuse matters. So yeah, who's using it and why is a big factor.

                          – Algy Taylor
                          Dec 9 '16 at 13:07








                        • 1





                          Exactly - REST is the kingdom of the nouns, JSON-RPC is verbs.

                          – Robert Grant
                          Jan 2 '17 at 9:09



















                        • It's great to find a kindred spirit! I'm working on something similar over here: github.com/dnault/therapi-json-rpc

                          – dnault
                          Mar 17 '16 at 22:06













                        • :) I'll look into it

                          – idelvall
                          Mar 18 '16 at 8:29











                        • Agree with this. REST works well for CRUD APIs since you have the obvious POST/GET/PUT/DELETE [PoGPuD? ;)] mapping. However, if your API doesn't fit comfortably in to those verbs, JSON-RPC may be a good option since the verbs are just going to confuse matters. So yeah, who's using it and why is a big factor.

                          – Algy Taylor
                          Dec 9 '16 at 13:07








                        • 1





                          Exactly - REST is the kingdom of the nouns, JSON-RPC is verbs.

                          – Robert Grant
                          Jan 2 '17 at 9:09

















                        It's great to find a kindred spirit! I'm working on something similar over here: github.com/dnault/therapi-json-rpc

                        – dnault
                        Mar 17 '16 at 22:06







                        It's great to find a kindred spirit! I'm working on something similar over here: github.com/dnault/therapi-json-rpc

                        – dnault
                        Mar 17 '16 at 22:06















                        :) I'll look into it

                        – idelvall
                        Mar 18 '16 at 8:29





                        :) I'll look into it

                        – idelvall
                        Mar 18 '16 at 8:29













                        Agree with this. REST works well for CRUD APIs since you have the obvious POST/GET/PUT/DELETE [PoGPuD? ;)] mapping. However, if your API doesn't fit comfortably in to those verbs, JSON-RPC may be a good option since the verbs are just going to confuse matters. So yeah, who's using it and why is a big factor.

                        – Algy Taylor
                        Dec 9 '16 at 13:07







                        Agree with this. REST works well for CRUD APIs since you have the obvious POST/GET/PUT/DELETE [PoGPuD? ;)] mapping. However, if your API doesn't fit comfortably in to those verbs, JSON-RPC may be a good option since the verbs are just going to confuse matters. So yeah, who's using it and why is a big factor.

                        – Algy Taylor
                        Dec 9 '16 at 13:07






                        1




                        1





                        Exactly - REST is the kingdom of the nouns, JSON-RPC is verbs.

                        – Robert Grant
                        Jan 2 '17 at 9:09





                        Exactly - REST is the kingdom of the nouns, JSON-RPC is verbs.

                        – Robert Grant
                        Jan 2 '17 at 9:09











                        14














                        I've been a big fan of REST in the past and it has many advantages over RPC on paper. You can present the client with different Content-Types, Caching, reuse of HTTP status codes, you can guide the client through the API and you can embed documentation in the API if it isn't mostly self-explaining anyway.



                        But my experience has been that in practice this doesn't hold up and instead you do a lot of unnecessary work to get everything right. Also the HTTP status codes often don't map to your domain logic exactly and using them in your context often feels a bit forced. But the worst thing about REST in my opinion is that you spend a lot of time to design your resources and the interactions they allow. And whenever you do some major additions to your API you hope you find a good solution to add the new functionality and you didn't design yourself into a corner already.



                        This often feels like a waste of time to me because most of the time I already have a perfectly fine and obvious idea about how to model an API as a set of remote procedure calls. And if I have gone through all this effort to model my problem inside the constraints of REST the next problem is how to call it from the client? Our programs are based on calling procedures so building a good RPC client library is easy, building a good REST client library not so much and in most cases you will just map back from your REST API on the server to a set of procedures in your client library.



                        Because of this, RPC feels a lot simpler and more natural to me today. What I really miss though is a consistent framework that makes it easy to write RPC services that are self-describing and interoperable. Therefore I created my own project to experiment with new ways to make RPC easier for myself and maybe somebody else finds it useful, too: https://github.com/aheck/reflectrpc






                        share|improve this answer




























                          14














                          I've been a big fan of REST in the past and it has many advantages over RPC on paper. You can present the client with different Content-Types, Caching, reuse of HTTP status codes, you can guide the client through the API and you can embed documentation in the API if it isn't mostly self-explaining anyway.



                          But my experience has been that in practice this doesn't hold up and instead you do a lot of unnecessary work to get everything right. Also the HTTP status codes often don't map to your domain logic exactly and using them in your context often feels a bit forced. But the worst thing about REST in my opinion is that you spend a lot of time to design your resources and the interactions they allow. And whenever you do some major additions to your API you hope you find a good solution to add the new functionality and you didn't design yourself into a corner already.



                          This often feels like a waste of time to me because most of the time I already have a perfectly fine and obvious idea about how to model an API as a set of remote procedure calls. And if I have gone through all this effort to model my problem inside the constraints of REST the next problem is how to call it from the client? Our programs are based on calling procedures so building a good RPC client library is easy, building a good REST client library not so much and in most cases you will just map back from your REST API on the server to a set of procedures in your client library.



                          Because of this, RPC feels a lot simpler and more natural to me today. What I really miss though is a consistent framework that makes it easy to write RPC services that are self-describing and interoperable. Therefore I created my own project to experiment with new ways to make RPC easier for myself and maybe somebody else finds it useful, too: https://github.com/aheck/reflectrpc






                          share|improve this answer


























                            14












                            14








                            14







                            I've been a big fan of REST in the past and it has many advantages over RPC on paper. You can present the client with different Content-Types, Caching, reuse of HTTP status codes, you can guide the client through the API and you can embed documentation in the API if it isn't mostly self-explaining anyway.



                            But my experience has been that in practice this doesn't hold up and instead you do a lot of unnecessary work to get everything right. Also the HTTP status codes often don't map to your domain logic exactly and using them in your context often feels a bit forced. But the worst thing about REST in my opinion is that you spend a lot of time to design your resources and the interactions they allow. And whenever you do some major additions to your API you hope you find a good solution to add the new functionality and you didn't design yourself into a corner already.



                            This often feels like a waste of time to me because most of the time I already have a perfectly fine and obvious idea about how to model an API as a set of remote procedure calls. And if I have gone through all this effort to model my problem inside the constraints of REST the next problem is how to call it from the client? Our programs are based on calling procedures so building a good RPC client library is easy, building a good REST client library not so much and in most cases you will just map back from your REST API on the server to a set of procedures in your client library.



                            Because of this, RPC feels a lot simpler and more natural to me today. What I really miss though is a consistent framework that makes it easy to write RPC services that are self-describing and interoperable. Therefore I created my own project to experiment with new ways to make RPC easier for myself and maybe somebody else finds it useful, too: https://github.com/aheck/reflectrpc






                            share|improve this answer













                            I've been a big fan of REST in the past and it has many advantages over RPC on paper. You can present the client with different Content-Types, Caching, reuse of HTTP status codes, you can guide the client through the API and you can embed documentation in the API if it isn't mostly self-explaining anyway.



                            But my experience has been that in practice this doesn't hold up and instead you do a lot of unnecessary work to get everything right. Also the HTTP status codes often don't map to your domain logic exactly and using them in your context often feels a bit forced. But the worst thing about REST in my opinion is that you spend a lot of time to design your resources and the interactions they allow. And whenever you do some major additions to your API you hope you find a good solution to add the new functionality and you didn't design yourself into a corner already.



                            This often feels like a waste of time to me because most of the time I already have a perfectly fine and obvious idea about how to model an API as a set of remote procedure calls. And if I have gone through all this effort to model my problem inside the constraints of REST the next problem is how to call it from the client? Our programs are based on calling procedures so building a good RPC client library is easy, building a good REST client library not so much and in most cases you will just map back from your REST API on the server to a set of procedures in your client library.



                            Because of this, RPC feels a lot simpler and more natural to me today. What I really miss though is a consistent framework that makes it easy to write RPC services that are self-describing and interoperable. Therefore I created my own project to experiment with new ways to make RPC easier for myself and maybe somebody else finds it useful, too: https://github.com/aheck/reflectrpc







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jun 14 '16 at 22:25









                            aheahe

                            1,6211518




                            1,6211518























                                11














                                According to the Richardson maturity model, the question is not REST vs. RPC, but how much REST?



                                In this view, the compliance to REST standard can be classified in 4 levels.




                                • level 0: think in terms of actions and parameters. As the article explains, this is essentially equivalent to JSON-RPC (the article explains it for XML-RPC, but same arguments hold for both).

                                • level 1: think in terms of resources. Everything relevant to a resource belong to the same URL

                                • level 2: use HTTP verbs

                                • level 3: HATEOAS


                                According to the creator of REST standard, only level 3 services can be called RESTful. However, this is a metric of compliance, not quality. If you just want to call a remote function that does a calculation, it probably makes no sense to have relevant hypermedia links in the response, neither differentiation of behavior based on the HTTP verb used. So, a such call inherently tends to be more RPC-like. However, lower compliance level does not necessarily mean statefulness, or higher coupling. Probably, instead of thinking REST vs. RPC, you should use as much REST as possible, but no more. Do not twist your application just to fit with the RESTful compliance standards.






                                share|improve this answer
























                                • +1 for levels 0, 1, and 2. However I've never seen a successful implementation of HATEOS, but have seen two miserably failed attempts.

                                  – mjhm
                                  Mar 21 '18 at 17:42
















                                11














                                According to the Richardson maturity model, the question is not REST vs. RPC, but how much REST?



                                In this view, the compliance to REST standard can be classified in 4 levels.




                                • level 0: think in terms of actions and parameters. As the article explains, this is essentially equivalent to JSON-RPC (the article explains it for XML-RPC, but same arguments hold for both).

                                • level 1: think in terms of resources. Everything relevant to a resource belong to the same URL

                                • level 2: use HTTP verbs

                                • level 3: HATEOAS


                                According to the creator of REST standard, only level 3 services can be called RESTful. However, this is a metric of compliance, not quality. If you just want to call a remote function that does a calculation, it probably makes no sense to have relevant hypermedia links in the response, neither differentiation of behavior based on the HTTP verb used. So, a such call inherently tends to be more RPC-like. However, lower compliance level does not necessarily mean statefulness, or higher coupling. Probably, instead of thinking REST vs. RPC, you should use as much REST as possible, but no more. Do not twist your application just to fit with the RESTful compliance standards.






                                share|improve this answer
























                                • +1 for levels 0, 1, and 2. However I've never seen a successful implementation of HATEOS, but have seen two miserably failed attempts.

                                  – mjhm
                                  Mar 21 '18 at 17:42














                                11












                                11








                                11







                                According to the Richardson maturity model, the question is not REST vs. RPC, but how much REST?



                                In this view, the compliance to REST standard can be classified in 4 levels.




                                • level 0: think in terms of actions and parameters. As the article explains, this is essentially equivalent to JSON-RPC (the article explains it for XML-RPC, but same arguments hold for both).

                                • level 1: think in terms of resources. Everything relevant to a resource belong to the same URL

                                • level 2: use HTTP verbs

                                • level 3: HATEOAS


                                According to the creator of REST standard, only level 3 services can be called RESTful. However, this is a metric of compliance, not quality. If you just want to call a remote function that does a calculation, it probably makes no sense to have relevant hypermedia links in the response, neither differentiation of behavior based on the HTTP verb used. So, a such call inherently tends to be more RPC-like. However, lower compliance level does not necessarily mean statefulness, or higher coupling. Probably, instead of thinking REST vs. RPC, you should use as much REST as possible, but no more. Do not twist your application just to fit with the RESTful compliance standards.






                                share|improve this answer













                                According to the Richardson maturity model, the question is not REST vs. RPC, but how much REST?



                                In this view, the compliance to REST standard can be classified in 4 levels.




                                • level 0: think in terms of actions and parameters. As the article explains, this is essentially equivalent to JSON-RPC (the article explains it for XML-RPC, but same arguments hold for both).

                                • level 1: think in terms of resources. Everything relevant to a resource belong to the same URL

                                • level 2: use HTTP verbs

                                • level 3: HATEOAS


                                According to the creator of REST standard, only level 3 services can be called RESTful. However, this is a metric of compliance, not quality. If you just want to call a remote function that does a calculation, it probably makes no sense to have relevant hypermedia links in the response, neither differentiation of behavior based on the HTTP verb used. So, a such call inherently tends to be more RPC-like. However, lower compliance level does not necessarily mean statefulness, or higher coupling. Probably, instead of thinking REST vs. RPC, you should use as much REST as possible, but no more. Do not twist your application just to fit with the RESTful compliance standards.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Oct 17 '17 at 14:36









                                blue_noteblue_note

                                11.8k32434




                                11.8k32434













                                • +1 for levels 0, 1, and 2. However I've never seen a successful implementation of HATEOS, but have seen two miserably failed attempts.

                                  – mjhm
                                  Mar 21 '18 at 17:42



















                                • +1 for levels 0, 1, and 2. However I've never seen a successful implementation of HATEOS, but have seen two miserably failed attempts.

                                  – mjhm
                                  Mar 21 '18 at 17:42

















                                +1 for levels 0, 1, and 2. However I've never seen a successful implementation of HATEOS, but have seen two miserably failed attempts.

                                – mjhm
                                Mar 21 '18 at 17:42





                                +1 for levels 0, 1, and 2. However I've never seen a successful implementation of HATEOS, but have seen two miserably failed attempts.

                                – mjhm
                                Mar 21 '18 at 17:42











                                6














                                Why JSON RPC:



                                In case of REST apis, we have to define a controller for each functionality/method we might need. As a result if we have 10 methods that we want accessible to a client, we have to write 10 controllers to interface the client's request to a particular method.



                                Another factor is, even though we have different controllers for each method/functionality, the client has to remember wether to use POST or GET. This complicates things further. On top of that to send data, one has to set the content type of the request if POST is used.



                                In case of JSON RPC, things are greatly simplified because most JSONRPC servers operate on POST HTTP methods and the content type is always application/json. This takes the load off of remembering to use proper HTTP method and content settings on client side.



                                One doesn't have to create separate controllers for different methods/functionalities the server wants to expose to a client.



                                Why REST:



                                You have separate URLs for different functionality the server wants to expose to client side. As a result, you can embed these urls.



                                Most of these points are debatable and completely depend upon the need of a person.






                                share|improve this answer






























                                  6














                                  Why JSON RPC:



                                  In case of REST apis, we have to define a controller for each functionality/method we might need. As a result if we have 10 methods that we want accessible to a client, we have to write 10 controllers to interface the client's request to a particular method.



                                  Another factor is, even though we have different controllers for each method/functionality, the client has to remember wether to use POST or GET. This complicates things further. On top of that to send data, one has to set the content type of the request if POST is used.



                                  In case of JSON RPC, things are greatly simplified because most JSONRPC servers operate on POST HTTP methods and the content type is always application/json. This takes the load off of remembering to use proper HTTP method and content settings on client side.



                                  One doesn't have to create separate controllers for different methods/functionalities the server wants to expose to a client.



                                  Why REST:



                                  You have separate URLs for different functionality the server wants to expose to client side. As a result, you can embed these urls.



                                  Most of these points are debatable and completely depend upon the need of a person.






                                  share|improve this answer




























                                    6












                                    6








                                    6







                                    Why JSON RPC:



                                    In case of REST apis, we have to define a controller for each functionality/method we might need. As a result if we have 10 methods that we want accessible to a client, we have to write 10 controllers to interface the client's request to a particular method.



                                    Another factor is, even though we have different controllers for each method/functionality, the client has to remember wether to use POST or GET. This complicates things further. On top of that to send data, one has to set the content type of the request if POST is used.



                                    In case of JSON RPC, things are greatly simplified because most JSONRPC servers operate on POST HTTP methods and the content type is always application/json. This takes the load off of remembering to use proper HTTP method and content settings on client side.



                                    One doesn't have to create separate controllers for different methods/functionalities the server wants to expose to a client.



                                    Why REST:



                                    You have separate URLs for different functionality the server wants to expose to client side. As a result, you can embed these urls.



                                    Most of these points are debatable and completely depend upon the need of a person.






                                    share|improve this answer















                                    Why JSON RPC:



                                    In case of REST apis, we have to define a controller for each functionality/method we might need. As a result if we have 10 methods that we want accessible to a client, we have to write 10 controllers to interface the client's request to a particular method.



                                    Another factor is, even though we have different controllers for each method/functionality, the client has to remember wether to use POST or GET. This complicates things further. On top of that to send data, one has to set the content type of the request if POST is used.



                                    In case of JSON RPC, things are greatly simplified because most JSONRPC servers operate on POST HTTP methods and the content type is always application/json. This takes the load off of remembering to use proper HTTP method and content settings on client side.



                                    One doesn't have to create separate controllers for different methods/functionalities the server wants to expose to a client.



                                    Why REST:



                                    You have separate URLs for different functionality the server wants to expose to client side. As a result, you can embed these urls.



                                    Most of these points are debatable and completely depend upon the need of a person.







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Nov 3 '17 at 7:42

























                                    answered Jun 12 '17 at 12:39









                                    Umer FarooqUmer Farooq

                                    5,60733154




                                    5,60733154























                                        2














                                        If you request resources, then RESTful API is better by design. If you request some complicated data with a lot of parameters and complicated methods other than simple CRUD, then RPC is the right way to go.






                                        share|improve this answer




























                                          2














                                          If you request resources, then RESTful API is better by design. If you request some complicated data with a lot of parameters and complicated methods other than simple CRUD, then RPC is the right way to go.






                                          share|improve this answer


























                                            2












                                            2








                                            2







                                            If you request resources, then RESTful API is better by design. If you request some complicated data with a lot of parameters and complicated methods other than simple CRUD, then RPC is the right way to go.






                                            share|improve this answer













                                            If you request resources, then RESTful API is better by design. If you request some complicated data with a lot of parameters and complicated methods other than simple CRUD, then RPC is the right way to go.







                                            share|improve this answer












                                            share|improve this answer



                                            share|improve this answer










                                            answered Jul 20 '16 at 6:54









                                            Adrian LiuAdrian Liu

                                            261312




                                            261312























                                                2














                                                Wrong question: imposes a manichean that not exist!



                                                You can use JSON-RPC with "less verb" (no method) and preserve the minimal standardization necessary for sendo id, parameters, error codes and warning messages. The JSON-RPC standard not say "you can't be REST", only say how to pack basic information.



                                                "REST JSON-RPC" exists! is REST with "best practices", for minimal information packing, with simple and solid contracts.





                                                Example



                                                (from this answer and didactic context)



                                                When dealing with REST, it generally helps to start by thinking in terms of resources. In this case, the resource is not just "bank account" but it is a transaction of that bank account... But JSON-RPC not obligates the "method" parameter, all are encoded by "path" of the endpoint.




                                                • REST Deposit with POST /Bank/Account/John/Transaction with JSON request {"jsonrpc": "2.0", "id": 12, "params": {"currency":"USD","amount":10}}.
                                                  The JSON response can be something as {"jsonrpc": "2.0", "result": "sucess", "id": 12}


                                                • REST Withdraw with POST /Bank/Account/John/Transaction ... similar.


                                                • ... GET /Bank/Account/John/Transaction/12345@13 ... This could return a JSON record of that exact transaction (e.g. your users generally want a record of debits and credits on their account). Something as {"jsonrpc": "2.0", "result": {"debits":[...],"credits":[...]}, "id": 13}. The convention about (REST) GET request can include encode of id by "@id", so not need to send any JSON, but still using JSON-RPC in the response pack.







                                                share|improve this answer


























                                                • See also stackoverflow.com/a/13952665/287948

                                                  – Peter Krauss
                                                  Jan 16 '17 at 22:41
















                                                2














                                                Wrong question: imposes a manichean that not exist!



                                                You can use JSON-RPC with "less verb" (no method) and preserve the minimal standardization necessary for sendo id, parameters, error codes and warning messages. The JSON-RPC standard not say "you can't be REST", only say how to pack basic information.



                                                "REST JSON-RPC" exists! is REST with "best practices", for minimal information packing, with simple and solid contracts.





                                                Example



                                                (from this answer and didactic context)



                                                When dealing with REST, it generally helps to start by thinking in terms of resources. In this case, the resource is not just "bank account" but it is a transaction of that bank account... But JSON-RPC not obligates the "method" parameter, all are encoded by "path" of the endpoint.




                                                • REST Deposit with POST /Bank/Account/John/Transaction with JSON request {"jsonrpc": "2.0", "id": 12, "params": {"currency":"USD","amount":10}}.
                                                  The JSON response can be something as {"jsonrpc": "2.0", "result": "sucess", "id": 12}


                                                • REST Withdraw with POST /Bank/Account/John/Transaction ... similar.


                                                • ... GET /Bank/Account/John/Transaction/12345@13 ... This could return a JSON record of that exact transaction (e.g. your users generally want a record of debits and credits on their account). Something as {"jsonrpc": "2.0", "result": {"debits":[...],"credits":[...]}, "id": 13}. The convention about (REST) GET request can include encode of id by "@id", so not need to send any JSON, but still using JSON-RPC in the response pack.







                                                share|improve this answer


























                                                • See also stackoverflow.com/a/13952665/287948

                                                  – Peter Krauss
                                                  Jan 16 '17 at 22:41














                                                2












                                                2








                                                2







                                                Wrong question: imposes a manichean that not exist!



                                                You can use JSON-RPC with "less verb" (no method) and preserve the minimal standardization necessary for sendo id, parameters, error codes and warning messages. The JSON-RPC standard not say "you can't be REST", only say how to pack basic information.



                                                "REST JSON-RPC" exists! is REST with "best practices", for minimal information packing, with simple and solid contracts.





                                                Example



                                                (from this answer and didactic context)



                                                When dealing with REST, it generally helps to start by thinking in terms of resources. In this case, the resource is not just "bank account" but it is a transaction of that bank account... But JSON-RPC not obligates the "method" parameter, all are encoded by "path" of the endpoint.




                                                • REST Deposit with POST /Bank/Account/John/Transaction with JSON request {"jsonrpc": "2.0", "id": 12, "params": {"currency":"USD","amount":10}}.
                                                  The JSON response can be something as {"jsonrpc": "2.0", "result": "sucess", "id": 12}


                                                • REST Withdraw with POST /Bank/Account/John/Transaction ... similar.


                                                • ... GET /Bank/Account/John/Transaction/12345@13 ... This could return a JSON record of that exact transaction (e.g. your users generally want a record of debits and credits on their account). Something as {"jsonrpc": "2.0", "result": {"debits":[...],"credits":[...]}, "id": 13}. The convention about (REST) GET request can include encode of id by "@id", so not need to send any JSON, but still using JSON-RPC in the response pack.







                                                share|improve this answer















                                                Wrong question: imposes a manichean that not exist!



                                                You can use JSON-RPC with "less verb" (no method) and preserve the minimal standardization necessary for sendo id, parameters, error codes and warning messages. The JSON-RPC standard not say "you can't be REST", only say how to pack basic information.



                                                "REST JSON-RPC" exists! is REST with "best practices", for minimal information packing, with simple and solid contracts.





                                                Example



                                                (from this answer and didactic context)



                                                When dealing with REST, it generally helps to start by thinking in terms of resources. In this case, the resource is not just "bank account" but it is a transaction of that bank account... But JSON-RPC not obligates the "method" parameter, all are encoded by "path" of the endpoint.




                                                • REST Deposit with POST /Bank/Account/John/Transaction with JSON request {"jsonrpc": "2.0", "id": 12, "params": {"currency":"USD","amount":10}}.
                                                  The JSON response can be something as {"jsonrpc": "2.0", "result": "sucess", "id": 12}


                                                • REST Withdraw with POST /Bank/Account/John/Transaction ... similar.


                                                • ... GET /Bank/Account/John/Transaction/12345@13 ... This could return a JSON record of that exact transaction (e.g. your users generally want a record of debits and credits on their account). Something as {"jsonrpc": "2.0", "result": {"debits":[...],"credits":[...]}, "id": 13}. The convention about (REST) GET request can include encode of id by "@id", so not need to send any JSON, but still using JSON-RPC in the response pack.








                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited May 23 '17 at 12:34









                                                Community

                                                11




                                                11










                                                answered Jan 16 '17 at 22:37









                                                Peter KraussPeter Krauss

                                                5,4461084174




                                                5,4461084174













                                                • See also stackoverflow.com/a/13952665/287948

                                                  – Peter Krauss
                                                  Jan 16 '17 at 22:41



















                                                • See also stackoverflow.com/a/13952665/287948

                                                  – Peter Krauss
                                                  Jan 16 '17 at 22:41

















                                                See also stackoverflow.com/a/13952665/287948

                                                – Peter Krauss
                                                Jan 16 '17 at 22:41





                                                See also stackoverflow.com/a/13952665/287948

                                                – Peter Krauss
                                                Jan 16 '17 at 22:41











                                                2














                                                I think, as always, it depends ...



                                                REST has the huge advantage of widespread public support and this means lots of tools and books. If you need to make an API that is used by a large number of consumers from different organisations then it is the way to go for only one reason: it is popular. As a protocol it is of course a total failure since there are too many completely different ways to map a command to a URL/verb/response.



                                                Therefore, when you write a single page web app that needs to talk to a backend then I think REST is way too complex. In this situation you do not have to worry about long term compatibility since the app and API can evolved together.



                                                I once started with REST for a single page web app but the fine grained commands between the web app and the server quickly drove me crazy. Should I encode it as a path parameter? In the body? A query parameter? A header? After the URL/Verb/Response design I then had to code this mess in Javascript, the decoder in Java and then call the actual method. Although there are lots of tools for it, it is really tricky to not get any HTTP semantics in your domain code, which is really bad practice. (Cohesion)



                                                Try making a Swagger/OpenAPI file for a medium complex site and compare that to a single Java interface that describes the remote procedures in that file. The complexity increase is staggering.



                                                I therefore switched from REST to JSON-RPC for the single page webapp. aI developed a tiny library that encoded a Java interface on the server and shipped it to the browser. In the browser this created a proxy for the application code that returned a promise for each function.



                                                Again, REST has its place just because it is famous and therefore well supported. It is also important to recognise the underlying stateless resources philosophy and the hierarchical model. However, these principles can just as easy be used in an RPC model. JSON RPC works over HTTP so it has the same advantages of REST in this area. The difference is that when you inevitably run into these functions that do not map well to these principles you're not forced to do a lot of unnecessary work.






                                                share|improve this answer





















                                                • 1





                                                  This answer made me realise the similarities between GraphQL and JSON-RPC and why GraphQL is becoming a popular choice for SPAs.

                                                  – Dennis
                                                  Nov 15 '17 at 16:38
















                                                2














                                                I think, as always, it depends ...



                                                REST has the huge advantage of widespread public support and this means lots of tools and books. If you need to make an API that is used by a large number of consumers from different organisations then it is the way to go for only one reason: it is popular. As a protocol it is of course a total failure since there are too many completely different ways to map a command to a URL/verb/response.



                                                Therefore, when you write a single page web app that needs to talk to a backend then I think REST is way too complex. In this situation you do not have to worry about long term compatibility since the app and API can evolved together.



                                                I once started with REST for a single page web app but the fine grained commands between the web app and the server quickly drove me crazy. Should I encode it as a path parameter? In the body? A query parameter? A header? After the URL/Verb/Response design I then had to code this mess in Javascript, the decoder in Java and then call the actual method. Although there are lots of tools for it, it is really tricky to not get any HTTP semantics in your domain code, which is really bad practice. (Cohesion)



                                                Try making a Swagger/OpenAPI file for a medium complex site and compare that to a single Java interface that describes the remote procedures in that file. The complexity increase is staggering.



                                                I therefore switched from REST to JSON-RPC for the single page webapp. aI developed a tiny library that encoded a Java interface on the server and shipped it to the browser. In the browser this created a proxy for the application code that returned a promise for each function.



                                                Again, REST has its place just because it is famous and therefore well supported. It is also important to recognise the underlying stateless resources philosophy and the hierarchical model. However, these principles can just as easy be used in an RPC model. JSON RPC works over HTTP so it has the same advantages of REST in this area. The difference is that when you inevitably run into these functions that do not map well to these principles you're not forced to do a lot of unnecessary work.






                                                share|improve this answer





















                                                • 1





                                                  This answer made me realise the similarities between GraphQL and JSON-RPC and why GraphQL is becoming a popular choice for SPAs.

                                                  – Dennis
                                                  Nov 15 '17 at 16:38














                                                2












                                                2








                                                2







                                                I think, as always, it depends ...



                                                REST has the huge advantage of widespread public support and this means lots of tools and books. If you need to make an API that is used by a large number of consumers from different organisations then it is the way to go for only one reason: it is popular. As a protocol it is of course a total failure since there are too many completely different ways to map a command to a URL/verb/response.



                                                Therefore, when you write a single page web app that needs to talk to a backend then I think REST is way too complex. In this situation you do not have to worry about long term compatibility since the app and API can evolved together.



                                                I once started with REST for a single page web app but the fine grained commands between the web app and the server quickly drove me crazy. Should I encode it as a path parameter? In the body? A query parameter? A header? After the URL/Verb/Response design I then had to code this mess in Javascript, the decoder in Java and then call the actual method. Although there are lots of tools for it, it is really tricky to not get any HTTP semantics in your domain code, which is really bad practice. (Cohesion)



                                                Try making a Swagger/OpenAPI file for a medium complex site and compare that to a single Java interface that describes the remote procedures in that file. The complexity increase is staggering.



                                                I therefore switched from REST to JSON-RPC for the single page webapp. aI developed a tiny library that encoded a Java interface on the server and shipped it to the browser. In the browser this created a proxy for the application code that returned a promise for each function.



                                                Again, REST has its place just because it is famous and therefore well supported. It is also important to recognise the underlying stateless resources philosophy and the hierarchical model. However, these principles can just as easy be used in an RPC model. JSON RPC works over HTTP so it has the same advantages of REST in this area. The difference is that when you inevitably run into these functions that do not map well to these principles you're not forced to do a lot of unnecessary work.






                                                share|improve this answer















                                                I think, as always, it depends ...



                                                REST has the huge advantage of widespread public support and this means lots of tools and books. If you need to make an API that is used by a large number of consumers from different organisations then it is the way to go for only one reason: it is popular. As a protocol it is of course a total failure since there are too many completely different ways to map a command to a URL/verb/response.



                                                Therefore, when you write a single page web app that needs to talk to a backend then I think REST is way too complex. In this situation you do not have to worry about long term compatibility since the app and API can evolved together.



                                                I once started with REST for a single page web app but the fine grained commands between the web app and the server quickly drove me crazy. Should I encode it as a path parameter? In the body? A query parameter? A header? After the URL/Verb/Response design I then had to code this mess in Javascript, the decoder in Java and then call the actual method. Although there are lots of tools for it, it is really tricky to not get any HTTP semantics in your domain code, which is really bad practice. (Cohesion)



                                                Try making a Swagger/OpenAPI file for a medium complex site and compare that to a single Java interface that describes the remote procedures in that file. The complexity increase is staggering.



                                                I therefore switched from REST to JSON-RPC for the single page webapp. aI developed a tiny library that encoded a Java interface on the server and shipped it to the browser. In the browser this created a proxy for the application code that returned a promise for each function.



                                                Again, REST has its place just because it is famous and therefore well supported. It is also important to recognise the underlying stateless resources philosophy and the hierarchical model. However, these principles can just as easy be used in an RPC model. JSON RPC works over HTTP so it has the same advantages of REST in this area. The difference is that when you inevitably run into these functions that do not map well to these principles you're not forced to do a lot of unnecessary work.







                                                share|improve this answer














                                                share|improve this answer



                                                share|improve this answer








                                                edited Oct 13 '17 at 7:39

























                                                answered Oct 13 '17 at 7:26









                                                Peter KriensPeter Kriens

                                                11.9k12648




                                                11.9k12648








                                                • 1





                                                  This answer made me realise the similarities between GraphQL and JSON-RPC and why GraphQL is becoming a popular choice for SPAs.

                                                  – Dennis
                                                  Nov 15 '17 at 16:38














                                                • 1





                                                  This answer made me realise the similarities between GraphQL and JSON-RPC and why GraphQL is becoming a popular choice for SPAs.

                                                  – Dennis
                                                  Nov 15 '17 at 16:38








                                                1




                                                1





                                                This answer made me realise the similarities between GraphQL and JSON-RPC and why GraphQL is becoming a popular choice for SPAs.

                                                – Dennis
                                                Nov 15 '17 at 16:38





                                                This answer made me realise the similarities between GraphQL and JSON-RPC and why GraphQL is becoming a popular choice for SPAs.

                                                – Dennis
                                                Nov 15 '17 at 16:38











                                                1














                                                REST is tightly coupled with HTTP, so if you only expose your API over HTTP then REST is more appropriate for most (but not all) situations. However, if you need to expose your API over other transports like messaging or web sockets then REST is just not applicable.






                                                share|improve this answer



















                                                • 1





                                                  REST is an architectural style and not protocol-dependant.

                                                  – Mark Cidade
                                                  Jun 9 '17 at 19:10











                                                • You are right REST is architectural principle. However, its theoretical foundation was heavily influenced by HTTP protocol and despite the claim of universal applicability it found no practical application beyond web domain. So, it is safe to say that when somebody mentions REST they refer to web services and not the architectural principle.

                                                  – dtoux
                                                  Jun 10 '17 at 23:27
















                                                1














                                                REST is tightly coupled with HTTP, so if you only expose your API over HTTP then REST is more appropriate for most (but not all) situations. However, if you need to expose your API over other transports like messaging or web sockets then REST is just not applicable.






                                                share|improve this answer



















                                                • 1





                                                  REST is an architectural style and not protocol-dependant.

                                                  – Mark Cidade
                                                  Jun 9 '17 at 19:10











                                                • You are right REST is architectural principle. However, its theoretical foundation was heavily influenced by HTTP protocol and despite the claim of universal applicability it found no practical application beyond web domain. So, it is safe to say that when somebody mentions REST they refer to web services and not the architectural principle.

                                                  – dtoux
                                                  Jun 10 '17 at 23:27














                                                1












                                                1








                                                1







                                                REST is tightly coupled with HTTP, so if you only expose your API over HTTP then REST is more appropriate for most (but not all) situations. However, if you need to expose your API over other transports like messaging or web sockets then REST is just not applicable.






                                                share|improve this answer













                                                REST is tightly coupled with HTTP, so if you only expose your API over HTTP then REST is more appropriate for most (but not all) situations. However, if you need to expose your API over other transports like messaging or web sockets then REST is just not applicable.







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered May 25 '16 at 20:52









                                                dtouxdtoux

                                                7471231




                                                7471231








                                                • 1





                                                  REST is an architectural style and not protocol-dependant.

                                                  – Mark Cidade
                                                  Jun 9 '17 at 19:10











                                                • You are right REST is architectural principle. However, its theoretical foundation was heavily influenced by HTTP protocol and despite the claim of universal applicability it found no practical application beyond web domain. So, it is safe to say that when somebody mentions REST they refer to web services and not the architectural principle.

                                                  – dtoux
                                                  Jun 10 '17 at 23:27














                                                • 1





                                                  REST is an architectural style and not protocol-dependant.

                                                  – Mark Cidade
                                                  Jun 9 '17 at 19:10











                                                • You are right REST is architectural principle. However, its theoretical foundation was heavily influenced by HTTP protocol and despite the claim of universal applicability it found no practical application beyond web domain. So, it is safe to say that when somebody mentions REST they refer to web services and not the architectural principle.

                                                  – dtoux
                                                  Jun 10 '17 at 23:27








                                                1




                                                1





                                                REST is an architectural style and not protocol-dependant.

                                                – Mark Cidade
                                                Jun 9 '17 at 19:10





                                                REST is an architectural style and not protocol-dependant.

                                                – Mark Cidade
                                                Jun 9 '17 at 19:10













                                                You are right REST is architectural principle. However, its theoretical foundation was heavily influenced by HTTP protocol and despite the claim of universal applicability it found no practical application beyond web domain. So, it is safe to say that when somebody mentions REST they refer to web services and not the architectural principle.

                                                – dtoux
                                                Jun 10 '17 at 23:27





                                                You are right REST is architectural principle. However, its theoretical foundation was heavily influenced by HTTP protocol and despite the claim of universal applicability it found no practical application beyond web domain. So, it is safe to say that when somebody mentions REST they refer to web services and not the architectural principle.

                                                – dtoux
                                                Jun 10 '17 at 23:27











                                                0














                                                I think there is one point people forgot to mention.
                                                If you already have a web app, then REST is desirable since you'll need the app server anyways and you can secure both using https...
                                                but if you do not have a web app, (just have an application), then RPC is desirable since you no longer need to setup an app server and configure it which is a hastle.
                                                Other than than, I don't see any real fundamental advantage in either.






                                                share|improve this answer




























                                                  0














                                                  I think there is one point people forgot to mention.
                                                  If you already have a web app, then REST is desirable since you'll need the app server anyways and you can secure both using https...
                                                  but if you do not have a web app, (just have an application), then RPC is desirable since you no longer need to setup an app server and configure it which is a hastle.
                                                  Other than than, I don't see any real fundamental advantage in either.






                                                  share|improve this answer


























                                                    0












                                                    0








                                                    0







                                                    I think there is one point people forgot to mention.
                                                    If you already have a web app, then REST is desirable since you'll need the app server anyways and you can secure both using https...
                                                    but if you do not have a web app, (just have an application), then RPC is desirable since you no longer need to setup an app server and configure it which is a hastle.
                                                    Other than than, I don't see any real fundamental advantage in either.






                                                    share|improve this answer













                                                    I think there is one point people forgot to mention.
                                                    If you already have a web app, then REST is desirable since you'll need the app server anyways and you can secure both using https...
                                                    but if you do not have a web app, (just have an application), then RPC is desirable since you no longer need to setup an app server and configure it which is a hastle.
                                                    Other than than, I don't see any real fundamental advantage in either.







                                                    share|improve this answer












                                                    share|improve this answer



                                                    share|improve this answer










                                                    answered Apr 7 '16 at 1:48









                                                    maxmax

                                                    4,10875184




                                                    4,10875184























                                                        0














                                                        It would be better to choose JSON-RPC between REST and JSON-RPC to develop an API for a web application that is easier to understand. JSON-RPC is preferred because its mapping to method calls and communications can be easily understood.



                                                        Choosing the most suitable approach depends on the constraints or principal objective. For example, as far as performance is a major trait, it is advisable to go for JSON-RPC (for example, High Performance Computing). However, if the principal objective is to be agnostic in order to offer a generic interface to be inferred by others, it is advisable to go for REST. If you both goals are needed to be achieved, it is advisable to include both protocols.



                                                        The fact which actually splits REST from JSON-RPC is that it trails a series of carefully thought out constraints- confirming architectural flexibility. The constraints take in ensuring that the client as well as server are able to grow independently of each other (changes can be made without messing up with the application of client), the calls are stateless (the state is regarded as hypermedia), a uniform interface is offered for interactions, the API is advanced on a layered system (Hall, 2010). JSON-RPC is rapid and easy to consume, however as mentioned resources as well as parameters are tightly coupled and it is likely to depend on verbs (api/addUser, api/deleteUser) using GET/ POST whereas REST delivers loosely coupled resources (api/users) in a HTTP. REST API depends up on several HTTP methods such as GET, PUT, POST, DELETE, PATCH. REST is slightly tougher for inexperienced developers to implement.



                                                        JSON (denoted as JavaScript Object Notation) being a lightweight data-interchange format, is easy for humans to read as well as write. It is hassle free for machines to parse and generate. JSON is a text format which is entirely language independent but practices conventions that are acquainted to programmers of the family of languages, consisting of C#, C, C++, Java, Perl, JavaScript, Python, and numerous others. Such properties make JSON a perfect data-interchange language and a better choice to opt for.






                                                        share|improve this answer




























                                                          0














                                                          It would be better to choose JSON-RPC between REST and JSON-RPC to develop an API for a web application that is easier to understand. JSON-RPC is preferred because its mapping to method calls and communications can be easily understood.



                                                          Choosing the most suitable approach depends on the constraints or principal objective. For example, as far as performance is a major trait, it is advisable to go for JSON-RPC (for example, High Performance Computing). However, if the principal objective is to be agnostic in order to offer a generic interface to be inferred by others, it is advisable to go for REST. If you both goals are needed to be achieved, it is advisable to include both protocols.



                                                          The fact which actually splits REST from JSON-RPC is that it trails a series of carefully thought out constraints- confirming architectural flexibility. The constraints take in ensuring that the client as well as server are able to grow independently of each other (changes can be made without messing up with the application of client), the calls are stateless (the state is regarded as hypermedia), a uniform interface is offered for interactions, the API is advanced on a layered system (Hall, 2010). JSON-RPC is rapid and easy to consume, however as mentioned resources as well as parameters are tightly coupled and it is likely to depend on verbs (api/addUser, api/deleteUser) using GET/ POST whereas REST delivers loosely coupled resources (api/users) in a HTTP. REST API depends up on several HTTP methods such as GET, PUT, POST, DELETE, PATCH. REST is slightly tougher for inexperienced developers to implement.



                                                          JSON (denoted as JavaScript Object Notation) being a lightweight data-interchange format, is easy for humans to read as well as write. It is hassle free for machines to parse and generate. JSON is a text format which is entirely language independent but practices conventions that are acquainted to programmers of the family of languages, consisting of C#, C, C++, Java, Perl, JavaScript, Python, and numerous others. Such properties make JSON a perfect data-interchange language and a better choice to opt for.






                                                          share|improve this answer


























                                                            0












                                                            0








                                                            0







                                                            It would be better to choose JSON-RPC between REST and JSON-RPC to develop an API for a web application that is easier to understand. JSON-RPC is preferred because its mapping to method calls and communications can be easily understood.



                                                            Choosing the most suitable approach depends on the constraints or principal objective. For example, as far as performance is a major trait, it is advisable to go for JSON-RPC (for example, High Performance Computing). However, if the principal objective is to be agnostic in order to offer a generic interface to be inferred by others, it is advisable to go for REST. If you both goals are needed to be achieved, it is advisable to include both protocols.



                                                            The fact which actually splits REST from JSON-RPC is that it trails a series of carefully thought out constraints- confirming architectural flexibility. The constraints take in ensuring that the client as well as server are able to grow independently of each other (changes can be made without messing up with the application of client), the calls are stateless (the state is regarded as hypermedia), a uniform interface is offered for interactions, the API is advanced on a layered system (Hall, 2010). JSON-RPC is rapid and easy to consume, however as mentioned resources as well as parameters are tightly coupled and it is likely to depend on verbs (api/addUser, api/deleteUser) using GET/ POST whereas REST delivers loosely coupled resources (api/users) in a HTTP. REST API depends up on several HTTP methods such as GET, PUT, POST, DELETE, PATCH. REST is slightly tougher for inexperienced developers to implement.



                                                            JSON (denoted as JavaScript Object Notation) being a lightweight data-interchange format, is easy for humans to read as well as write. It is hassle free for machines to parse and generate. JSON is a text format which is entirely language independent but practices conventions that are acquainted to programmers of the family of languages, consisting of C#, C, C++, Java, Perl, JavaScript, Python, and numerous others. Such properties make JSON a perfect data-interchange language and a better choice to opt for.






                                                            share|improve this answer













                                                            It would be better to choose JSON-RPC between REST and JSON-RPC to develop an API for a web application that is easier to understand. JSON-RPC is preferred because its mapping to method calls and communications can be easily understood.



                                                            Choosing the most suitable approach depends on the constraints or principal objective. For example, as far as performance is a major trait, it is advisable to go for JSON-RPC (for example, High Performance Computing). However, if the principal objective is to be agnostic in order to offer a generic interface to be inferred by others, it is advisable to go for REST. If you both goals are needed to be achieved, it is advisable to include both protocols.



                                                            The fact which actually splits REST from JSON-RPC is that it trails a series of carefully thought out constraints- confirming architectural flexibility. The constraints take in ensuring that the client as well as server are able to grow independently of each other (changes can be made without messing up with the application of client), the calls are stateless (the state is regarded as hypermedia), a uniform interface is offered for interactions, the API is advanced on a layered system (Hall, 2010). JSON-RPC is rapid and easy to consume, however as mentioned resources as well as parameters are tightly coupled and it is likely to depend on verbs (api/addUser, api/deleteUser) using GET/ POST whereas REST delivers loosely coupled resources (api/users) in a HTTP. REST API depends up on several HTTP methods such as GET, PUT, POST, DELETE, PATCH. REST is slightly tougher for inexperienced developers to implement.



                                                            JSON (denoted as JavaScript Object Notation) being a lightweight data-interchange format, is easy for humans to read as well as write. It is hassle free for machines to parse and generate. JSON is a text format which is entirely language independent but practices conventions that are acquainted to programmers of the family of languages, consisting of C#, C, C++, Java, Perl, JavaScript, Python, and numerous others. Such properties make JSON a perfect data-interchange language and a better choice to opt for.







                                                            share|improve this answer












                                                            share|improve this answer



                                                            share|improve this answer










                                                            answered Jun 15 '16 at 10:14









                                                            SinghKunalSinghKunal

                                                            92




                                                            92























                                                                0














                                                                I use vdata for RPC protocol:
                                                                http://vdata.dekuan.org/



                                                                1, PHP and JavaScript are both okay.
                                                                2, Cross-origin resource sharing(CORS) call is still okay.






                                                                share|improve this answer




























                                                                  0














                                                                  I use vdata for RPC protocol:
                                                                  http://vdata.dekuan.org/



                                                                  1, PHP and JavaScript are both okay.
                                                                  2, Cross-origin resource sharing(CORS) call is still okay.






                                                                  share|improve this answer


























                                                                    0












                                                                    0








                                                                    0







                                                                    I use vdata for RPC protocol:
                                                                    http://vdata.dekuan.org/



                                                                    1, PHP and JavaScript are both okay.
                                                                    2, Cross-origin resource sharing(CORS) call is still okay.






                                                                    share|improve this answer













                                                                    I use vdata for RPC protocol:
                                                                    http://vdata.dekuan.org/



                                                                    1, PHP and JavaScript are both okay.
                                                                    2, Cross-origin resource sharing(CORS) call is still okay.







                                                                    share|improve this answer












                                                                    share|improve this answer



                                                                    share|improve this answer










                                                                    answered Oct 30 '16 at 16:22









                                                                    Liu QixingLiu Qixing

                                                                    91




                                                                    91

















                                                                        protected by cassiomolin 2 days ago



                                                                        Thank you for your interest in this question.
                                                                        Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                                                        Would you like to answer one of these unanswered questions instead?



                                                                        Popular posts from this blog

                                                                        generate and download xml file after input submit (php and mysql) - JPK

                                                                        Angular Downloading a file using contenturl with Basic Authentication

                                                                        Can't read property showImagePicker of undefined in react native iOS