admin@glassfish.java.net

REST and HTTP Verb Question

From: Jason Lee <jason.d.lee_at_oracle.com>
Date: Mon, 10 May 2010 15:16:39 -0500

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?

-- 
Jason Lee
Senior Member of Technical Staff
GlassFish Administration Console
Oracle Corporation
Phone x31197/+1 405-343-1964
Blog http://blogs.steeplesoft.com