[rest-practices] Links for actions

Itamar Heim iheim at redhat.com
Wed May 12 10:56:29 UTC 2010


> From: Mark McLoughlin [mailto:markmc at redhat.com]
...
> > >
> > >         <actions>
> > >           <link href="/api/instances/inst1/reboot" rel="reboot"/>
> > >           <link href="/api/instances/inst1/stop" rel="stop"/>
> > >           <link href="/api/instances/inst1" rel="destroy"/>
> > >         </actions>
> > [IH] just wondering, so if I ask for a list of 500 instances, I will
> get
> > all actions possible on all instances 500 times as well?
>
> Yes
>
> If it becomes an issue, one way around it is to make a collection just
> include references e.g.
>
>        <vms>
>          <vm id="1" href="/vms/1"/>
>          <vm id="2" href="/vms/2"/>
>          ...
>          <vm id="500" href="/vms/500"/>
>        </vms>
>
> or you could include partial representations:
>
>        <vms>
>          <vm id="1" href="/vms/1">
>            <name>vm1</name>
>            <status>UP</status>
>          </vm>
>          <vm id="2" href="/vms/2"/>
>            <name>vm2</name>
>            <status>UP</status>
>          </vm>
>          ...
>          <vm id="500" href="/vms/500">
>            <name>vm500</name>
>            <status>DOWN</status>
>          </vm>
>        </vms>
[IH] how would the client pass the request or a partial entity (parameter 
wise)?
>
> > isn't this mixing introspection with data?
>
> Yes, that's a key part of REST's "hypermedia as the engine of
> application state" principle
[IH] that's quite an overhead of data when it is not needed.
>
> The hypermedia encapsulates not only the current state of the entity,
> but also, how its state can be changed




More information about the rest-practices mailing list