Ühel kenal päeval, K, 2010-05-05 kell 19:59, kirjutas Scott Wilson:
> On 5 May 2010, at 19:03, Raido Kuli wrote:
> 
> > Hi,
> > 
> > In Wookie REST API Properties section are two requests:
> > 
> > POST {wookie}/properties 
> > {params: instance_params, propertyname, propertyvalue,
> > [is_public=true]}   
> > 
> > Sets a property for the specified instance. If is_public=true is set,
> > the property set is a Shared Data entry; otherwise it is a
> > Preference.   
> > 
> > PUT {wookie}/properties 
> > {params: instance_params, propertyname, propertyvalue}   
> > 
> > Updates the value of the specified property of the specified Widget
> > Instance.
> > 
> > ---
> > 
> > I've noticed that POST request does both - creates and updates when
> > doing second request. For updating property value, there's no need for
> > PUT request. I guess it should be more like:
> > 
> > a) POST request to create new property, if exists return some HTTP error
> > status code - that update is not possible via POST
> > 
> > b) PUT request then for updating.
> > 
> > Currently it seems, that PUT request isn't needed at all, so I can be
> > and should removed if only POST will be used for creating and updating
> > property.
> 
> Looking over the controller code you're right, POST and PUT are actually 
> identical in their behaviour.
> 
> So the question is whether to (1) not bother with PUT, or (2) make POST and 
> PUT behave in a more typical manner; i.e. POST should throw an exception if 
> the property exists, and PUT should throw an exception if it doesn't. 

In my opinion only POST does the work, but it has to be said out some
where, that second request updates property value.

Reply via email to