Loading ...
Sorry, an error occurred while loading the content.

19027Re: [rest-discuss] Link relation for adding a resource

Expand Messages
  • Jan Algermissen
    Sep 2, 2012
    • 0 Attachment
      On Sep 1, 2012, at 8:00 PM, Erik Wilde wrote:

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

      I am interpreting POST along the lines Roy referred to ( "append" ) since that has arguably been blurred, my thinking seems 'wrong' in that sense.

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

      Huh? Seems you are mixing editing with creating entries, or?

      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.

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

      Yes you could, but IMHO it's YAGNI and from a @RESTPOLICE POV, forbidden :-)


      Jan


      >
      > cheers,
      >
      > dret.
      >
      > --
      > erik wilde | mailto:dret@... - tel:+1-510-2061079 |
      > | UC Berkeley - School of Information (ISchool) |
      > | http://dret.net/netdret http://twitter.com/dret |
      >
    • Show all 11 messages in this topic