Re: PUT and DELETE methods in 200 code

On 05/04/2011, at 5:18 PM, Julian Reschke wrote:

> On 05.04.2011 17:37, Cameron Heavon-Jones wrote:
>> ...
>> Do you foresee a scenario where the same request is submitted yet a different response is required? This would be impossible for any service and against the authority of the service to define it's own implementation.
>> ...
> 
> Yes.
> 
>> In the example of a combined agent (i'm thinking in the same vein of the old netscape navigator?) wouldn't the different functional contexts define different requests?
>> 
>> Why would a WebDAV service initiate a request with "Accept: text/html" if it doesn't want html?
> 
> Unlikely on purpose, but there's a risk that they may be sending a default because they don't care.

Ok, i think that's a different case then. If a UA is sending Accept that, as far as the service is concerned, it shouldn't be, then it should be given the response which is suitable for that UA. In the case of WebDAV, default to text/plain with a status message.

This amounts to recommending UA-sniffing, but in the case of UAs that "don't care" i think this is a measured response.


> Also, absence of "Accept:" implies "accepts anything", so you wouldn't be able to do conneg by the spec.

This is ok...the default for a UA which accepts anything can be to provide nothing - or just the text/plain message response.


> 
>>>> I think a distinction must be made between the response of a GET on the resource to the response of a PUT or DELETE (or even POST) to a resource.
>>> 
>>> Not sure I understand.
>>> 
>>> When the browser does a GET on the authorable resource, do you want to return a simple representation, or a form that allows *editing* that representation?
>> 
>> The representation should be whatever the resource defines... if i had an authorable resource i would probably be inclined to return a simple representation for the base and maybe provide a link to an editable representation, eg:
>> 
>> http://www.example.com/user/123
>> 
>> http://www.example.com/user/123?edit=true
>> 
>> or maybe
>> 
>> http://www.example.com/user/123/profileEditor
> 
> True. Like it's done a lot in Wikis.
> 
> So, when you serve the form at
> 
>  http://www.example.com/user/123?edit=true
> 
> where will it direct the PUT to, and what representation would you expect in the PUT result?
> 
> > ...
> 
> Best regards, Julian


The PUT should be directed to the resource which is actually being edited - http://www.example.com/user/123. A PUT to the editor might be to change the representation of the editor?

The response however, could be a custom html response informing the use their action has been performed and with any additional information from the service about the action taken.

This would seem to be preferable to returning the same representation as GET annotated with request-specific data.

cam

Received on Tuesday, 5 April 2011 16:36:15 UTC