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-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? POST does not have any 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. you 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. 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 |