Chapter 17. REST Primer

REST, which stands for Representational State Transfer, is not a protocol. Born out of a chapter of the Ph.D. dissertation of Roy Fielding, one of the original architects of the Web, it is more of a description of how the HTTP protocol was meant to be used. REST has been given a lot of attention recently, especially in the Rails community, which has thrown its support behind REST with ActiveResource. Rails developers can be expected to, by and large, use ActiveResource, since it is there. But there are a number of issues that application developers should be aware of before jumping on the bandwagon.

In this chapter, I’ll introduce “textbook” REST. We’ll then contrast this style of REST with what most people mean when they say REST or RESTful. Then, we’ll go over some of the issues you should be aware of when choosing to create REST interfaces. The first concern is with the way ActiveResource encourages you to create services based off of database tables; this problem is avoidable but becoming endemic. The next concern is with integration; because REST is a convention—and one no one agrees upon yet—integration with external parties can be a challenge compared with the relative ease of XML-RPC services.

REST Basics

To understand the problems REST faces, and the problems you may face if you adopt REST for your service architecture, first we must go back to the theory of REST and its original goals. Only then can we understand the challenges faced ...

Get Enterprise Rails now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.