One common myth is that REST based systems require that URIs are opaque. This is not the case on the Web or in REST. A server may inform a client that there is structure in the URI by means of referencing a specification(s) that specify the structure within a representation. An example of this is HTML Forms, where the HTML specification defines a mapping of form parameters into URIs for HTTP Get requests.
The W3C TAG answered this question in http://www.w3.org/2001/tag/doc/metaDataInURI-31.html
with
Assignment authorities may publish specifications detailing the structure and semantics of the URIs they assign. Other users of those URIs may use such specifications to infer information about resources identified by URI assigned by that authority.
http://tech.groups.yahoo.com/group/rest-discuss/message/5369 with
"Clients are allowed to treat a URI as being structured if that structure is defined by standard (e.g., scheme and authority in "http") or if the server tells the client how its URI is structured.
What is opaque is the client's view of the URI when it is processing a request. The advantage is well said in:
"Ignoring any semantically significant data in a URI allows operations on a resource to be orthogonal to identification of the resource."
Having said that URIs are not necessarily opaque, URIs ought to be chosen that enable a human to guess about the meaning as well as guess other URIs. As said by the TAG
"Users therefore benefit from the ability to infer either the nature of the named resource, or the likely URI of other resources, from inspection of a URI"
The caveat is that such assumptions may be incorrect and the user needs to guard against incorrect assumptions.
We will not concern ourselves with the academic possibility that the Web architecture is not aligned with the REST thesis, nor that
Some further discussion is at http://microformats.org/wiki/rest/opacity
Leave a comment