One of the frustrations I have is the common confusion over REST services and POX services for those trying to understand it from scratch. It does not help that some popular services that claim to be REST or technically POX. Flickr is one of these IMO. REST services expose resources through a uri mapping while POX services are generally exposing methods to get at resources. yes there is much more to the details of the styles of returning information, but its gotten to the point where may services are using HTTP to return data and calling it a REST API without really handling it in that style.
For example, look at the following fictitious uri’s:
http://foo.johnpapa.net/someservice/widgets/123
http://foo.johnpapa.net/someservice/?method=search.johnpapa.net&id=123
http://foo.johnpapa.net/someservice/?method=getWidget&id=123
The first uri shows a fictitious service that makes a widget resource available and returns the widget with ID = 123. This example uses the REST style of service.
The second and third are arguably REST or arguably POX. Many services today use this style and call it REST. This example shows a fictitious service that calls a searching method that returns a widget with ID =123. Same job for both, but the style of the uri implies its calling a method and exposing methods, and not resources.
So has REST and POX become PROX, PEST, ROX or some other morphed term?
What about this uri?
http://foo.johnpapa.net/stories/topic/movies?count=20&appkey=12345
This one uses a uri to grab the last 20 stories where the topic is “movies”. Yes, this is just like the Digg REST API service. This example uses a uri to locate a resource. What a concept! U.R.L. …. resource locator!
Here is another service:
http://webservices.amazon.com/onca/xml?Service=AWSECommerceService
&AWSAccessKeyId=putYourKeyHere&Operation=ItemSearch
&SearchIndex=Books&ResponseGroup=Medium&Keywords=Silverlight
This is directly from Amazon’s API. It indicates that the AWSECommerceService is going to be hit and it passes a bunch of parms to get back the resources. This gets fuzzy … is this strictly REST or POX … or PEST?
Cloud services have become increasingly popular. I’ve written several apps against Twitter, Digg, Flickr, Amazon, and other services returning JSON and XML. They all claim to be RESTful, which they certainly do have some of REST’s style in them. But one of the asppects of RESTful services is to open the door to resources.
Is it important that everything under the sun is being called REST? Its not killer … the important thing is that services are growing and making it easier to consume more information using resources. Whether the services strictly follow RESTful behavior or not is not that important overall, but it is confusing as heck for people who are trying to weed through all of the aspects of POX, REST, HTTP, WebClient, HttpWebRequest, JSON, XML, SOAP, WS*, ASMX, WCF, and a plethora of other terms out there. My point is that we all need to take a step back from terms and theory and patterns and instead focus on what we are trying to accomplish. I don’t care if I use a REST service or sneaker net (well, that would be slow) as long as it is scalable, can be implemented in a timely manner, performs well and does the job.
Really, all we want is a way to get to our data. Isn’t it?