--- layout: layout.njk title: REST - Explained For Beginners --- # REST - What is it, really? There is no topic that generates more confusion in web development than the idea of Representational State Transfer, known as REST. This term comes from [Chapter 5](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm) of [Roy Fielding's](https://en.wikipedia.org/wiki/Roy_Fielding) PhD thesis at [U.C. Irvine](https://www.uci.edu/). In this essay we will go through this Chapter and summarize the important concepts for non-academic web developers. The thesis is dense and involves a lot of technical jargon that isn't relevant to people who aren't academics interested in formal PhD thesis writing. By the end of this essay you should have a better handle on REST, and the concept of a [Uniform Interface](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_5) in particular. ## Overview The first thing to understand about REST is that *it is a description of the original web*. Fielding describes REST as an "architectural style for distributed hypermedia systems", which sounds fancy but just means the web we all know and love: clicking on hyperlinks, submitting forms, looking at images, reading paragraphs and all that jazz. It was *NOT* created as a description of a particular approach for JSON APIs, although that is the context that most people hear about REST today in. Fielding was describing the early web and, in particular, how it was different from earlier client/server architectures. ## Section 5.1 Deriving Rest In [section 5.1](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1), unfortunately for non-academics, Fielding adopts the technique of deriving REST from first principles. Here I will summarize each section and clarify and add context in the important ones. ### [Client Server](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_2) REST is, of course, a client-server architecture, since the web is a client (browser) server (http server) system. ### [Stateless](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_3) The web, most developers know, is intended to be stateless. All requests should encapsulate all information necessary to understand that request. For example, there should not be a long running transaction implicity associated with a series of requests, as you might have with a SQL database session. ### [Cache](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_4) HTTP, you probably know, has a [caching mechanism](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching) built into it. You don't need to know the details of this now, but may explore it later. ### [Uniform Interface](https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_1_5) This section, in my mind, is the crux of the REST architecture and, unfortunately, is very brief, so we will spend some time expanding on it, rather that just summarizing it. The chapter begins: > The central feature that distinguishes the REST architectural style from other network-based styles > is its emphasis on a uniform interface between components To clarify the discussion around exactly what the uniform interface is, let's consider some simple HTML that I hope everyone reading this will understand: ```html