Web Request

The request is made in a context that can include metadata such as identity, credentials, and preferred response form. The content of the request itself can be kept simple in this model.

from Blueoxen.net

Uniform Interfaces

It's all about this!

"REST typically replaces the "do something" concept with a "make something so" concept. If you think about it, all "do something" can be modeled this way. Instead of "make this kind of state transition", just "make your state this". You have to get into specific examples to see how this works"

"The uniform interface is meant to evolve over time. That is why it is built from three different parts that serve different purposes: identifiers, methods, and document types. Each part is designed to change independently of the other parts. New methods are not meant to require the addition of new document types. New document types are not meant to require the addition of new methods."

Standard interactions

  • A GET to an identifier means "Give me a copy of your information in a particular document format".
  • A PUT to that identifier means "Replace your information with mine".
  • POST adds information, and
  • DELETE eliminates information.

Simple Example

An example: Instead of a "turnOnTheLightbulb?" request to a server object, we have a PUT "true" to the http://example.com/lightbulb/lit object supplied by the server. The http://example.com/lightbulb/lit object also responds to a GET request that returns true or false. POST is an "add information" request that doesn't make sense for the lightbulb, nor does it really make sense to DELETE the lightbulb. So those requests would fail with a response indicating the fact.