Re: ETag and resource representations

Erik Wilde <[email protected]> Wed, 14 Aug 2013 16:23:10 +0200
Newsgroups gmane.comp.web.services.rest
Message-ID <[email protected]>
hello jan.

On 2013-08-14 16:11 , Jan Algermissen wrote:
> On 14.08.2013, at 03:11, Hubert A Le Van Gong <[email protected]> wrote:
>> I have a question about associating ETag to resources in a REST-based architecture.
>> Would you recommend associating a single ETag to the canonical (i.e. complete) resource or rather use a different ETag for each representations of said resource.
>> For instance, if I consider a library (full of books) as a resource. The view of that resource (i.e. the list of books returned) may vary based on the age of the reader (or any other criteria). Should I consider one ETag for the library as a whole or should I create an ETag for each representation returned to each reader?
> ETag applies to the representation. If the actual bytes of the representation differ  the ETag must differ.

that's correct for strong ETags (the default), but not the case for weak 
ETags (which a server can choose to use).

http://tools.ietf.org/html/rfc2616#section-13.3.3

i'd say that weak ETags are mostly used to have ETags survive 
non-essential differences (hit counters are the canonical example). it 
would be interesting to hear whether services are using them for other 
purposes like the one hubert mentioned.

cheers,

dret.

-- 
erik wilde | mailto:[email protected]  -  tel:+1-510-2061079 |
            | UC Berkeley  -  School of Information (ISchool) |
            | http://dret.net/netdret http://twitter.com/dret |