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

18570Re: [rest-discuss] Where should I POST to?

Expand Messages
  • Mike Kelly
    Mar 1, 2012
    • 0 Attachment
      On Thu, Mar 1, 2012 at 7:45 AM, Ruben Verborgh <ruben.verborgh@...> wrote:
      > Hi everyone,
      >
      > A hypothetical blog application:
      > - /posts/43 identifies a blog post resource
      > - /posts/43/comments/3 identifies a comment resource on this blog post
      >
      > Here are different ideas to create a comment:
      > - POST on /posts/43
      >  According to the definition of POST [1], this should be acceptable under “annotation of existing resources”.
      > - POST on /posts/43/comments
      >  According to the definition of POST [1], this should be acceptable under “posting a message […]”
      >
      > The question: which one(s) of the above seem acceptable, which one is “best”?
      >

      They're both valid. The first option is arguably a slightly better
      interaction as it's more visible because, as you say, the comments are
      represented from this resource and so a successful POST would
      automatically invalidate it in any participating caches. That's quite
      useful because it allows you more generous Cache-Control max-age
      values - it's particularly useful for gateway caching, specifically.

      If your clients are driven by hypertext you can pick whichever one you
      want.. if you found that you needed to switch from one to the other -
      changing the URI would not disturb your clients.

      Cheers,
      Mike
    • Show all 8 messages in this topic