Short version of the question:
Does a "GET" in a particular URI need to match what was a "PUT" for that URI?
I think no. That's why:
Given that a resource is an abstract thing that is theoretically unknowable by the client, when we do PUT, we should only send the view. Based on combing according to RFC2616, it is not exactly indicated what this means for a resource that has many (potentially endless?) Views, but here are my thoughts; let me know if you agree:
My expectation is that if I GOT a resource view, all other resource views in this URI should be consistent (potentially updated) as needed. In other words, you tell the resource "use this view to redefine yourself."
So I should be able to do this:
Put / resources / foo / myvacation
Content Type: image / jpg
...
And follow this:
GET / resources / foo / myvacation
Accept: image / png
...
and get an updated version of myvacation in a different format (assuming the server knows how to do this). By extrapolating this, this composite atomic “image + metadata” PUT must also be legal:
Put / resources / foo / myvacation
Content-type: multipart / form-data p>
Content-disposition: form-data; name = "Document"
Content Type: image / jpg
[..]
Content-disposition: form-data; name = "IPTC"
Content Type: app / iptc
[..]
Content-disposition: form-data; name = "EXIF"
Content-type: application / exif
[..]
And then, since the server-side content negotiation (RFC2616, section 12.1) can be based on everything, we can use the document content by default for this:
GET / resources / foo / myvacation
Content Type: image / jpg
[..]
or if you think that I am doing this section of RFC 2396, section 3.4 "The request component is a string of information that will be interpreted by the resource." means that the URI with the query string refers to the same resource as the URI without the query string (and is isomorphic to simply sending the application / x -form-urlencoded data to the resource), then this should also be legal:
GET / resources / foo / myvacation? content = exif
Content-type: application / exif
[..]
The PUT description says:
The PUT method requests that the private object be stored in the supplied Request-URI.
For me, this is pretty anti-REST unless you read it very liberally. My interpretation is "The PUT method requires that the resource be created or updated in the provided Request-URI based on the representation of the private object."
Later we will receive:
The main difference between POST and PUT requests is reflected in the different Request-URIs. The URI in the POST request identifies the resource that will process the enclosed object. This resource can be a process of accepting data, a gateway to another protocol, or a separate entity that receives annotations. In contrast, the URI in the PUT request identifies the object enclosed with the request - the user agent knows what the URI is, and the server SHOULD NOT try to apply the request to another resource.
We also need to read this creatively, but the key bits here are “know what a URI is” and “apply a request”.
So, for me, the representation returned by the GET at the given URI does not have to be the same representation that was the PUT for the given URI, it just needs to be consistent.
True or false?