REST in peace

Within the descriptions of REST as an architectural style, every information or resource is supposed to be identifiable by a resource identifier or URI. Components in a RESTful environment can apply actions on resources according to their representational state. A webbrowser for example issues a request for a particular URI and retrieves the current state of the resource in xhtml. The browser is then capable of rendering the representation into a colorful webpage.

According to a purist view on REST, the distinctiveness of an URI implies its persistence independent of the action applied to it (/fileinfo/delete/myfile.txt and /fileinfo/add/myfile.txt are two different uris for the same resource). Moreover, REST relies on HTTP with its variety of request methods and it is not counted to be RESTful, if all actions have to be performed via GET. Besides the argument of not using HTTP the way it should be, there are also reasons from the view of the implementation that i find more convincing: Parameters are a source for errors, lead to ambigous requests, have to be caught and evaluated etc.

The specifications suggest a mapping of HTTP request methods that refer to particular functions:

Method Operation
GET retrieve retrieves the representaiton of a resource
HEAD retrieves metadata for the
representation and the resource
POST create creates a resource
PUT update updates a resource
DELETE delete deletes a resource

The perfect world is nice. However, in practice one hardly finds anything beyond GET and POST methods in relation to REST apis. GET for read-only requests and POST often combines requests to either create or update a resource. An interesting option would be to include reflection mechanisms into HEAD requests. Especially since REST doesn't has something like the unnecessary complicated WSDL to describe a service. The ways to define REST apis seem to be quite versatile. Yahoo for example defines a single resource for the websearch api. Further adjustements on the result representation are all applicable via parameters.

References / more:

 
(1)
Permalink
Posted in: |

http 1.1 ranges

Support for ranges?

HEAD /test.mp3 HTTP/1.1
Host:blog.var.cc

HTTP/1.1 200 OK
Date: Sun, 18 Dec 2005 21:09:07 GMT
Server: Apache/2.0.54 (Ubuntu) PHP/5.1.1
Last-Modified: Sun, 18 Dec 2005 18:16:00 GMT
ETag: "a706f-bacb1-6d309800"
Accept-Ranges: bytes
Content-Length: 765105
Content-Type: audio/mpeg

Request the first 100 bytes

GET /test.mp3 HTTP/1.1
Host:blog.var.cc
Range: bytes=0-100

HTTP/1.1 206 Partial Content
Date: Sun, 18 Dec 2005 21:14:29 GMT
Server: Apache/2.0.54 (Ubuntu) PHP/5.1.1
Last-Modified: Sun, 18 Dec 2005 18:16:00 GMT
ETag: "a706f-bacb1-6d309800"
Accept-Ranges: bytes
Content-Length: 101
Content-Range: bytes 0-100/765105
Content-Type: audio/mpeg

Requests bytes 0-100 and 200-250. Response body contains range-parts delimited by a boundary.

GET /test.mp3 HTTP/1.1
Host:blog.var.cc
Range: bytes=0-100,200-250

HTTP/1.1 206 Partial Content
Date: Sun, 18 Dec 2005 21:16:15 GMT
Server: Apache/2.0.54 (Ubuntu) PHP/5.1.1
Last-Modified: Sun, 18 Dec 2005 18:16:00 GMT
ETag: "a706f-bacb1-6d309800"
Accept-Ranges: bytes
Content-Length: 351
Content-Type: multipart/byteranges; boundary=40838f1dda9586bd8


--40838f1dda9586bd8
Content-type: audio/mpeg
Content-range: bytes 0-100/765105

// binary data

--40838f1dda9586bd8
Content-type: audio/mpeg
Content-range: bytes 200-250/765105

// binary data

→ ftp://ftp.isi.edu/in-notes/rfc2616.txt

Permalink
Posted in: |

1-2/2

LiveSearch

Blogroll

Relayed

Archive

Buttons

  • RSS 2.0 Feed
  • Latest comments
  • XHTML 1.0 compliant
  • Powered by Flux CMS
  • Powered by Popoon

Login


BXCMSNG Errors:
Notice[8] Undefined index: 0 in [BX_PROJECT_DIR]/inc/bx/plugins/blog/categories.php at line 59.