- Individual resources are identified in requests using URIs as resource identifiers. The resources themselves are conceptually separate from the representations that are returned to the client. For example, the server does not send its database, but rather, some HTML, XML or JSON that represents some database records expressed, for instance, in Finnish and encoded in UTF-8, depending on the details of the request and the server implementation.
- When a client holds a representation of a resource, including any metadata attached, it has enough information to modify or delete the resource on the server, provided it has permission to do so.
- Each message includes enough information to describe how to process the message. For example, which parser to invoke may be specified by an Internet media type (previously known as a MIME type). Responses also explicitly indicate their cache-ability.
-
Clients deliver state via body contents, query-string parameters, request headers and the requested URI (the resource name). Services deliver state to clients via body content, response codes, and response headers. This is technically referred-to as hypermedia (or hyperlinks within hypertext).
-
Aside from the description above, HATEOS also means that, where necessary, links are contained in the returned body (or headers) to supply the URI for retrieval of the object itself or related objects. We'll talk about this in more detail later.
- Uniform Interface
- Stateless
- Client-Server
- Cacheable
- Layered System
- Code on Demand (optional)
- Defines the interface between client and server
- Simplifies and decouples the architecture
- Foundamental to RESTful design
- For us this means:
- HTTP verbs (GET, PUT, POST, DELETE)
- URIs (resource name)
- HTTP response (status, body)
- Server contains no client state
- Each request contains enough context to process the message
- Self-descriptive message
- Any session state is held on the client
- Assume a disconnected system
- Separation of concerns
- Uniform interface is the link between the two
- Server responses (representations) are cacheable
- Implicitly
- Explicitly
- Negotiated
- Client can't assume direct connection to server
- Software or hardware intermediaries between client and server
- Improves scalability
- Server can temporarily extend client
- Transfer logic to client
- Client executes logic
- For example:
- Java applets
- JavaScript
- The only optional constraint
- Scalability
- Simplicity
- Modifiability
- Visibility
- Portability
- Reliability