3

A resource can be identified by multiple URIs. e.g.

/person/1234
/person/list?fname=John
/person/list?lname=Doe

all of the above might contain a resource: Person -

id: 1234
fname: John
lname: Doe
age: 10

Say you want to change John Doe's age from 10 to 15. So you PUT the following to /person/1234

id: 1234
fname: John
lname: Doe
age: 15

How do I force the client to invalidate the other 2 urls?

Sam
  • 99
  • 1
  • 2
  • 7

2 Answers2

0

Change the ETag returned by the other two URLs to a new value (eg, a hash of the data).

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
  • Let me rephrase my problem. The client has already invoked the 3 URLs before it made the update. So it already has the representations of the resource. Let's say that the expires header was set on those representations to be in an hour from now. After the update was made, the other two resources should have been stale immediately. But the client will not know that unless it makes a GET on them, which won't happen for an hour. – Sam Aug 29 '11 at 02:20
  • 1
    You can't tell the client to invalidate something without making a request, unless you build an invalidate command into your protocol. – SLaks Aug 29 '11 at 02:23
  • Add some command to the response (perhaps a custom header) that tells the client to invalidate a specific URL. HTTP does not have such a command, so you'd need to make one yourself. – SLaks Aug 29 '11 at 12:17
0

Make /person/list?fname=John and /person/list?lname=Doe redirect to /person/1234 instead of returning the entity data themselves.

fumanchu
  • 14,419
  • 6
  • 31
  • 36
  • Alternatively, return a Content-Location: /person/1234 header for requests to the two URIs /person/list?.... That will tell any cache that it should consider any copies of such responses as stale. http://www.ietf.org/id/draft-ietf-httpbis-p6-cache-16.txt (Section 2.5) – Jan Algermissen Aug 30 '11 at 10:31