Re: Link relation for adding a resource

Erik Wilde <[email protected]>
Newsgroups gmane.comp.web.services.rest
Message-ID <[email protected]>
hello jan.

On 2012-09-02 04:38 , Jan Algermissen wrote:
>> why do you think POST has create semantics?
> I am interpreting POST along the lines Roy referred to ( "append" ) since that has arguably been blurred, my thinking seems 'wrong' in that sense.

i wouldn't call it wrong, just more constrained than it actually is. if 
it were "append" only, we wouldn't have anything other than "append" to 
do non-append things with. i am trying to avoid explaining the HTTP 
methods as equivalents of CRUD operations, it tends to confuse people.

> 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.

agreed here, if you say it's a collection, then clients may implicitly 
try a POST, if that's what collections imply. but.... {see further down)

>> 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.
> Huh? Seems you are mixing editing with creating entries, or?

yes i did. my apologies for the confusion!

> 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.

aren't you contradicting yourself a little bit here? it seems to me that 
above you're saying that a client needs to understand something is a 
collection (this would be signaled by the media type, right?) that might 
support POST. so we need this level of shared understanding, and i agree 
that one possible design is to not have an explicit link and instead say 
that "a create link is implied to the same URI, so that clients can try 
POST." but that needs to be specified somewhere, and it needs to be in 
the media type, right? the media type can use an "implicit link" ("use 
the same URI and POST to it") or an explicit one ("follow the 'create' 
link and POST to that URI"), but one way or the other, there is a "typed 
link" and there is a rule what HTTP method to use when following it.

cheers,

dret.

-- 
erik wilde | mailto:[email protected]  -  tel:+1-510-2061079 |
            | UC Berkeley  -  School of Information (ISchool) |
            | http://dret.net/netdret http://twitter.com/dret |
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.