Hi Mark,
The idea is that the action *itself* is a resource, specifically a
sub-resource of the entity resource on which it operates, which is created
by the POST to the action URI.
The advantge is that there's a natural idiom for querying the status and
outcome of an (asynchronous) action, i.e. GET /vms/XXX/start/YYY where XXX
is the VM guid and YYY is the guid for the transient resource representing
the action in its pending, in-progress and completed states. This transient
resource is retained for a short period post-completion,after which any
further GETs are redirected back to the corresponding entity resource.
In terms of the general from of the actions representation (i.e. the links
in the entity representation) we were also probably influenced somewhat by
the Deltacloud API design:
http://deltacloud.org/api.html#h4_4
Cheers,
Eoghan
On 16 September 2010 17:08, Mark Lamourine <markllama(a)redhat.com> wrote:
> ----- "Eoghan Glynn" <eoghan.glynn(a)gmail.com> wrote:
>
> > Hi Geert,
> >
> > Interesting idea.
> >
> > So for the sake of comparison, what we currently model as:
> >
> > POST /hosts/123/install
> > Content-Type: application/xml
> > <action>
> > <root_password>geronimo</root_password>
> > </action>
> >
> > you're suggesting we change to:
> >
> > POST /hosts/123/actions
> > Content-Type: application/xml
> > <action>
> > <command>approve</command>
> > <root_password>geronimo</root_password>
> > </action>
> >
>
> I'm just starting to follow, but I was going to ask about action URIs
> myself. It would seem that the POST should go to the
> object (resource) itself, and the method call and parameters would be
> described in the POST body.
>
>
> I'd suggest something like this:
>
> POST /hosts/123
> Content-Type: application/xml
> <action method="approve">
> <param name="root_password">geronimo</param>
> <!--... -->
> </action>
>
> There are models for this in XML-RPC already (Yes, that's XML RPC, but
> it's still applicable, I think).
>
> It seems to me that object methods don't deserve a resource all their
> own. There should be a way to query the list of available actions on
> a resource (with their parameters and an indication of which are
> required or defaulted)
>
> GET /hosts/123/actions
> <actions>
> <action method="">
> <param name="" required="true|false"
[default=""] />
> ...
> </action>
> ...
> </actions>
>
> POST /hosts/123
> ...
> <action method="">
> <param name="">value</param>
> ...
> </action>
>
> An action is something you want the resource to do. The list of
> actions is something you want to ask for from the resource.
>
> - Mark
_______________________________________________
rhevm-api mailing list
rhevm-api(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/rhevm-api