Re: Multiple representations of the same resource without content negotiation

hello all.

On 2012-09-24 11:24 , "Ashok Malhotra" <ashok.malhotra@oracle.com> wrote:
>As things stand, content negotiation can only be used to negotiate
>different
>encodings of the same resource.  For example, a document in English or in
>French,  Or the temperature in Fahrenheit or Celsius.  It cannot be used
>to,
>say, negotiate between a text description and a picture.

there's absolutely nothing keeping you from negotiating different
representations of the same resource, such as one in PDF and one in HTML,
and that actually is one of the most important ways services make sure
they serve as many clients as possible: provide semantically equivalent
representations of the same URI-identified resource.

>My recommendation would be to give distinct URIs to different
>representations.
>For example, if the URI is for a rock then
>.../therock/description
>.../therock/jpeg

that's one pattern for doing it, but there's absolutely nothing wrong with
one URI and having different representations for it. which has the added
benefit that you can do things on the HTTP level instead of having to
reinvent the wheel on a higher level: if a client prefers JOEG, it says so
in the HTTP request and will get the JPEG, and if a client does not
specify a preference is gets whatever the server thinks might work best
for that client.

cheers,

dret.

Received on Monday, 24 September 2012 18:31:18 UTC