O'Reilly logo

Advanced Rails by Brad Ediger

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. REST, Resources, and Web Services

There are only two hard things in Computer Science: cache invalidation and naming things.

—Phil Karlton

The architectural principles of Representational State Transfer, or REST, have been taking the Rails world by storm. The idea behind REST has been around since Roy Fielding first described it in his 2000 doctoral dissertation. However, the ideas have only started to gain traction among Rails developers since David Heinemeier Hansson’s presentation of those ideas in 2006 and the subsequent adoption of RESTful principles in Rails 1.2. RESTful design is a new way of thinking about network architecture based on an observation of how the Web works.

What Is REST?

In short, REST is a unifying theory for how “distributed hypermedia” systems (primarily, the World Wide Web) are best organized and structured. The term was coined by Roy Fielding, coauthor of the HTTP specification, in his 2000 doctoral dissertation Architectural Styles and the Design of Network-Based Software Architectures.[63] The dissertation extracts a set of principles that are common to network architectures, based on an examination of the structure of the Web and the HTTP protocol. Starting with the “null style,” which is the absence of constraints on architecture, Fielding arrives at REST by placing a series of constraints on network architecture:

Client-Server

The client-server constraint imposes a separation of data storage from user interface and presentation. The most important ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required