admin@glassfish.java.net

Re: REST and HTTP Verb Question

From: Ludovic Champenois <ludovic.champenois_at_oracle.com>
Date: Mon, 10 May 2010 13:21:12 -0700

On 5/10/10 1:16 PM, Jason Lee wrote:
> I have a question about HTTP verbs and how we're using them in the
> REST API. When I first looked at the code, I saw that we're using
> POST to update elements, which contradicted my understanding of how
> HTTP verbs are supposed to be used under REST, so I did some digging.
> These links support my understanding:
>
>
> http://en.wikipedia.org/wiki/Representational_State_Transfer#RESTful_web_services
>
> https://www.ibm.com/developerworks/webservices/library/ws-restful/
>
> However, this link contradicts it (and note the source ;):
>
> http://java.sun.com/developer/technicalArticles/WebServices/restful/
>
> To muddy the waters a bit, RESTful Java with JAX-RS is ambivalent on
> the issue.
>
> My question, then, is how should we handle things? Personally, I
> prefer the POST to create, PUT to update approach, but I know that
> causes problems with HTML clients (which, to be honest, doesn't bother
> me too much, as I don't see that as a major format for us). *If* we
> are going to make a change in how we handle the verbs (we don't
> support PUT at all right now), we should probably do it before we
> start banging the drum publicly about this too much more.
>
> Any thoughts from anyone more familiar with the original design
> decisions?
>
IIRC, our usage around this issue was reviewed by Paul Sandoz.
Ludo