Dr. Mark Humphrys

School of Computing. Dublin City University.

Home      Blog      Teaching      Research      Contact

Search:

CA216      CA249      CA318

CA400      CA651      CA668


REST




Properties of RESTful systems

See Ch.5 of Roy Fielding's PhD.

Properties of RESTful systems:


  1. Client-server model.
    Data storage on server only. UI on client only.

  2. Stateless.
    Basic HTTP model is stateless. One URL request has no relation to later URL request.
    There are ways to keep state on Web though. Built on top of a stateless protocol.

  3. Cacheable.
    The HTTP model aims to reduce duplicate requests by caching data on client.
    It builds in a model where responses can be defined as cachable or not.
    See "Cache-Control" in HTTP headers.

  4. Uniform interface to resources:

    1. Resource address passed in request.
      Web uses URLs as universal address of resources (same address for each client to use).
      See URI schemes on Web.

    2. Response contains description of resource type.
      See MIME types.

    3. HATEOAS ("Hypermedia as the Engine of Application State")
      Hypermedia-like system. Responses contain addresses for further resources. (Page contains links to more pages.)

  5. Layered system.
    Intermediate servers can be introduced between client and server. Can do caching, security.
    See Proxy servers on the Web.


He adds as optional:


  1. Code-On-Demand.
    Client does not need to install applications in advance. Client stays simple.
    Server sends code to client to implement functionality at run-time.
    See JavaScript.



Read-write RESTful systems

Some RESTful systems may be primarily read-write systems.
The normal Web is mixed (large parts read-only, other parts read-write).

In general:
Say we have collections of resources, and an individual resource is a member of a collection, in a read-write system.
We might define our RESTful API methods as follows.


Method call What it does Permanent effect
GET (collection URI) List URIs of members of collection
e.g. See Readable web directories
No
PUT (collection URI) Replace entire collection with uploaded data Yes
POST (collection URI) Add new element to collection Yes
DELETE (collection URI) Delete entire collection Yes
GET (member URI) Client retrieves copy of member of collection No
PUT (member URI) Replace member with uploaded data Yes
DELETE (member URI) Delete member Yes

 


Feeds      w2mind.org

On Internet since 1987.