POX and REST … or ROX and PEST ?

    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?

    DotNetKicks Image
    #1 Brian Henderson on 8.24.2008 at 8:49 PM

    Do you have any resources for RESTful best practices? Do you plan to cover this topic your upcoming book?



    #2 John Papa on 8.24.2008 at 9:06 PM

    Brian ... My book will be covering how to use WCF, ASMX, RSS, RESTful services (and POX, SOAP, etc) from Silverlight. I'll also cover how to call and consume them all using different libraries and strategies. I have examples of using Live Search, Twitter, Flickr, Amazon and others from Silverlight that I plan ion including in the book.

    I won't be covering the creation of a pure RESTful service architecture in the book, though I admit writing this book has made me realize that there is a niche that could be filled with a solid best practices book on the topic of RESTful services. Perhaps my next book will cover that :)



    #3 Ryan Haney on 8.25.2008 at 10:52 AM

    "Really, all we want is a way to get to our data. Isn’t it?"

    Yes, but I want to create applications that use services ASAP. I want tools that will allow me to connect to any service, generate a service proxy and be up and running with reasonable effort - regardless of service. The issue is that there is no standard for creating services. There are companies that are making gobs of money creating libraries that abstract interfaces with common services like PayPal and other various payment gateways, services like Amazon etc, and that tells me 2 things are wrong: The right tools just aren't available, or the API is too complex.



    Leave a Comment