On Fri, Feb 01, 2008 at 07:40:19AM -0800, vince kraemer wrote:
> Jakub Podlesak wrote:
> >On Thu, Jan 31, 2008 at 07:25:01PM -0800, Peter Williams wrote:
> >
> >>Is there a document detailing the inputs & outputs for V3's REST api?
> >>
> >>I found the one here:
> >>http://wiki.glassfish.java.net/Wiki.jsp?page=V3AdminCommands
> >>
> >
> >the above described api doesn't look very RESTfully.
> >It uses verbs to specify methods in URIs. It is probably
> >fine as long as it is not called REST api.
> >
> >~Jakub
> >
>
> I am not sure I understand your comment. Can you provide a specific
> example of what you mean and a suggested improvement that would resolve
> the issue?
I just poited out, that the API is not RESTful, so it is better to avoid
calling it REST API. I was not so brave to suggest changes in the API.
The specific example was then provided by Paul Sandoz, who suggested concrete
changes to make the API RESTful. I agree, that having such a truly RESTful API
in GlassFish would be great. Please see the Paul's e-mail with suggested REST API
attached. The only thing i would change in the API would be s/__asadmin/asadmin/
(i do not like the underscores in the URI path).
~Jakub
>
> Thanks,
> vbk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
--
Jakub Podlesak
http://blogs.sun.com/japod
attached mail follows:
Jakub Podlesak wrote:
> On Thu, Jan 31, 2008 at 07:25:01PM -0800, Peter Williams wrote:
>> Is there a document detailing the inputs & outputs for V3's REST api?
>>
>> I found the one here:
>> http://wiki.glassfish.java.net/Wiki.jsp?page=V3AdminCommands
>
> the above described api doesn't look very RESTfully.
> It uses verbs to specify methods in URIs. It is probably
> fine as long as it is not called REST api.
>
Agreed. Although from the documentation i don't think it makes any
claims to be :-) Although i would strongly encourage that we make it a
RESTful API.
From this documentation it is not clear what the actual HTTP method is
used with the URIs, GET or POST? if the former then it is very unRESTful
and breaks the semantics of the HTTP GET method which should not have
unintended side effects (imagine a web crawler traversing such URIs and
unintentionally causing side-effects, or reloading the URI in a browser,
or clicking in such a URI in a email message).
IMHO i think it possible to create a nice RESTful API that is easy to
use by both machines and browsers. We could even create some WADL for it
and transform that to some nice documentation [1].
For example:
// get the list of applications
// returns a list of URIs for each application
// use query param to limit scope of list
GET
http://localhost:8080/__asadmin/applications
// Deploy new application
POST
http://localhost:8080/__asadmin/applications
// use application/x-www-form-urlencoded
// or multipart/form-data
// GET the state of an application 1
GET
http://localhost:8080/__asadmin/applications/1
// Undeploy the application
DELETE
http://localhost:8080/__asadmin/applications/1
// Redeploy the application
PUT
http://localhost:8080/__asadmin/applications/1
// use application/x-www-form-urlencoded
// or multipart/form-data
// get the list of modules
// returns a list of URIs for each module
GET
http://localhost:8080/__asadmin/modules
// get the list of containers
// returns a list of URIs for each containers
GET
http://localhost:8080/__asadmin/containers
// get the version
GET
http://localhost:8080/__asadmin/version
// get the domain state
GET
http://localhost:8080/__asadmin/domain
// get the domain state
PUT
http://localhost:8080/__asadmin/domain
// use application/x-www-form-urlencoded
// get the high-level state of everything
GET
http://localhost:8080/__asadmin
If using PUT/DELETE are in issue it is possible to wrap them in POST use
a filter on the server side to set the appropriate HTTP method.
Paul.
[1]
http://www.mnot.net/webdesc/
> ~Jakub
>
>> which lists the commands, but I'm really looking for the one where if
>> the "User-agent" is set to "hk2-agent", then specially formatted data is
>> returned (e.g. Manifest format for list-applications, etc) and what the
>> data can be expected to be.
>>
>> If no such document, when and where can I expect to find this
>> information? Or do I have to read the source :o
>>
>> -Peter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: dev-help_at_glassfish.dev.java.net