What is REST and why do we use it? Part 1: Introduction to REST

Why should you use REST in building your web service or application? That’s what we’ll look at in this series. The first reason is our old friend, “loose coupling.” But first, let’s discuss what REST is, so that we have a solid foundation before diving into why you should use it.

REST (short for “REpresentational State Transfer”) is an architectural pattern for building application programming interfaces (or APIs) that are used with a stateless transfer protocol. That’s just a fancy way of saying, REST is a way to build a web service or application so that programs on the Internet can easily talk to it.

In somewhat more concrete terms, REST says that, in general, you should define the objects that your service exposes to the general public with URLs, and the actions that you take on those objects are described by the methods or “verbs” of the HTTP protocol. Not all methods are appropriate for every object, so a big part of the design should be defining which methods can be used on which objects and what the results of those operations will be. There is a lot of emergent complexity from this simple pairing of objects and verbs—whole books have been written on the topic—that I will get into eventually, but it’s beyond the scope of this one article.

REST was first described by Dr. Roy Fielding in his PhD dissertation. Looking back at the history of REST and the web, and assessing the current state of the field, it’s tempting to regard Dr. Fielding as a visionary. There is no reason, however, that the Internet had to develop this way. The widespread adaoption of REST is not a fated evolution of technology. Rather, Dr. Fielding’s dissertation is a sort of self-fulfilling prophecy, an idea that technologists glommed onto and made it happen.1

If you want more details about REST, I suggest RestApiTutorial.com, Wikipedia, and Google. The next article in this series will discuss loosely coupling your system componets with REST.

  1. In this regard, Fielding’s dissertation is not unlike Dr. Gordon Moore’s proclamation of his somewhat-more-famous self-fulfilling prophecy, Moore’s Law. [return]