19027Re: [rest-discuss] Link relation for adding a resource
- Sep 2, 2012On Sep 1, 2012, at 8:00 PM, Erik Wilde wrote:
> hello jan.I am interpreting POST along the lines Roy referred to ( "append" ) since that has arguably been blurred, my thinking seems 'wrong' in that sense.
> On 2012-09-01 05:44 , Jan Algermissen wrote:
> > On Aug 31, 2012, at 6:07 PM, Paul Cohen wrote:
> >> I would like to define, in JSON, a link that provides a way to add a
> >> new resource to a collection of resources.
> > HTTP POST has that semantic already, there is no need to use a link relation for that.
> why do you think POST has create semantics?
Anyhow, you do not need to specify alink relation for adding items. it is sufficient to say that collections have that semantic. The use of POST follows naturally, because what else would you use? A client is free to try a PUT and will find out at run time whether that works.
> POST does not have anyHuh? Seems you are mixing editing with creating entries, or?
> semantics other than doing something non-safe non-idempotent. while
> create fits that pattern, it's much more specific and not something that
> is in any way defined by HTTP itself.
> > All you need to know is that some resource has collection semantics, so you should tell the client that /photos is a collection rather than focussing on the action.
> you're assuming that by exposing collection semantics this inherently
> means you can POST to create. again, that's not something that HTTP
> tells you. for example, AtomPub says that in order to create, you have
> to POST to an "edit" link, and not just to the collection itself.
That aside, the interaction descriptions the AtomPub spec gives, are an over specification, because the server is free to do what it wants and the client has to be able to deal with that. Constraining the methods to use is a kind of coupling you cannot have (in a REStful system).
It is interesting that people usually seem to think specification of the method to use is necessary to implement clients and servers, but when you think about it, the choices are so limited that a developers knows the method to use anyhow.
Hints are good, but hey are just that, hints.
> youYes you could, but IMHO it's YAGNI and from a @RESTPOLICE POV, forbidden :-)
> could define a media type where the rule would be that you can always
> POST to a collection's URI to create a new resource, but that would be
> semantics defined by that media type, and not by HTTP itself.
> erik wilde | mailto:dret@... - tel:+1-510-2061079 |
> | UC Berkeley - School of Information (ISchool) |
> | http://dret.net/netdret http://twitter.com/dret |
- << Previous post in topic Next post in topic >>