Written By Jon Peppers

What is REST?

August 04, 2011 | development / technology

There are a lot of misconceptions about what REST or Representational State Transfer is.  Many people see an example of a REST API and merely think of it as a standard for making URLs to perform create, read, update, and delete (CRUD) operations against a web server.  

However, it has nothing to do with how your web service works specifically, but your architecture at a much higher level. The concept of RESTful systems was originally conceived by Roy T. Fielding, one of the authors of the HTTP specification that greatly influenced how the web works today.

Think of REST as having these principles:

  • There is a client and server that communicate using standard HTTP protocol.
  • As much logic as possible is handled by the server.
  • Future changes to the system happen on the server and should not affect existing clients.
  • A REST API uses loose conventions that a client can easily understand.
  • REST is so generalized, as it may be "accidentally" reused by other clients.

Lets look at an example of a RESTful system.

  1. A client for the system navigates to a standard URL for a list of commands.
  2. The client picks a command and executes it.
  3. The server returns a new list of commands, and any possible data to be displayed.
  4. Go back to step 2.

Similar to your web browser, right?  Wait.  Where is the format?  Is it JSON or XML?

A RESTful system has little to do with the format that data is presented in.  It's merely centered around the way clients talk to your server, and putting the bulk work of the system onto the server.

Notice how dynamic everything is.  You could completely rewrite the system server side and the client would continue to work correctly.  This is the primary (and huge) benefit of a RESTful system.

One disadvantage to REST, is it requires the client to be somewhat sophisticated.  A client has to be able to dynamically present commands to the user, and be able to handle future changes on the server.  The server also has to supply some knowledge to the client as to what commands are available.  This could even include supplying specifics about how to layout the UI, but should be generalized so it can be used by a wide range of clients.

In conclusion, think of REST merely as a dynamic web service.  It promotes reuse and flexibility while maintaining the functionaliy of existing clients.  It is not JSON, XML, or even a URL scheme.  What makes a RESTful system RESTful is determined by how cleverly it was designed for reuse.

Share this Article

Related Articles