REST services : the basics

Google Glass apps transfer data to and from the Mirror API using RESTful web services. So what exactly are REST services?

Quite simply, REST stands for Representational State Transfer and is the foundation of the RESTful architecture. This is generally considered to be Roy Fielding’s doctoral thesis, Architectural Styles and the Design of Network-based Software Architectures. While you can read through the thesis, REST in terms of Rails boils down to two main principles:

  • Using resource identifiers such as URLs to represent resources.
  • Transferring representations of the state of that resource between system components.

For example, the following HTTP request:

DELETE /photos/17

would be understood to refer to a photo resource with the ID of 17, and to indicate a desired action – deleting that resource. REST is a natural style for the architecture of web applications, and Rails hooks into this shielding you from many of the RESTful complexities and browser quirks.

If you’d like more details on REST as an architectural style, these resources are more approachable than Fielding’s thesis: