Appendix B. Overview of REST

REST stands for Representational State Transfer. To understand what it means, consider a simple web-based social application.

  1. A user visits the home page of the application by typing the address in the browser.

  2. The browser submits an HTTP request to the server.

  3. The server responds with an HTML document containing some links and forms.

  4. The user types her status in a form and submits the form.

  5. The browser submits another HTTP request to the server.

  6. The server processes the request and responds with another page.

This cycle continues until the user stops browsing. Except for a few exceptions, most websites and web-based applications follow the same pattern. Let’s see how this application is related to REST.

Uniform Resource Identifiers

What the user types into the browser at the start of the previous interaction is a Uniform Resource Identifier (URI). Another commonly used name for this is a Uniform Resource Locator (URL). URI is a more generalized term that you can use to refer to either a location (URL) or a name.

A URI is an identifier of a resource. In most cases, URIs are opaque for clients.

Resources

A resource is anything that can be identified by a URI. In the first step of the previous flow, the URI typed by the user is the address of a resource that corresponds to a web page. In a typical static website, every web page is a resource.

In the fourth step, the part of the server that updates the user’s status is another resource. The HTML form that is used to ...

Get RESTful Web Services Cookbook 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.