Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML-RPC vs REST

Tags:

I am about to build a little server in here and want to create an API for it.

I am deciding what is better and already ruled out SOAP since that thing is a mess in my opinion. I am left with REST and XML-RPC.

I really enjoy XML-RPC, it is really simple to implement and it is regular enough that all clients can use it easily.

These days all the cool kids are doing RESTful stuff, sometimes with a JSON payload or XML document or even HTTP POST variables.

I think those guys always reinvent the wheel for each service. I don't see what one could gain by going with REST over using XML-RPC.

Question:

So, can someone here provide practical reasons for implementing an API using REST+JSON over just using XML-RPC?

like image 265
Andre Garzia Avatar asked Jul 29 '12 15:07

Andre Garzia


1 Answers

REST vs RPC implementations like XML-RPC is a false dichotomy. You can implement a RESTful interface using XML-RPC (although you probably wouldn't want to). That said, there are a bunch of reasons why you would want to expose resources in a RESTful way using vanilla HTTP instead of rolling your own RPC interface using a technology like XML-RPC:

  1. Future actions are primarily controlled by the server instead of hard-coded in the client via procedure calls, simplifying deployment and versioning.
  2. Existing implementations for things like caching, throttling, and versioning can be used out of the box.
  3. The custom procedures that you roll with an RPC interface are likely to be too narrowly scoped.

See this blog post for more info.

like image 166
Tyson Avatar answered Sep 18 '22 22:09

Tyson