RE: potentialAction for Classes?

On Wednesday, May 21, 2014 9:26 PM, Jason Douglas wrote:
> > > One way to strike a better balance is to only refer to the action
> > > specifics (including its EntryPoint, etc.) by reference on the bug
> > > instances.  Then you're only saying the supported actions and not
> > > repeating the action metadata.  You're limiting to processors that can
> > > fully dereference objects and re-compose the graph LOD-style, though.
> > > Some are limited to one page at a time.
> 
> > Yeah, that's also a quite elegant solution but unfortunately it
> > doesn't really work with the current design as the EntryPoint is
> > associated to the action and not vice-versa.
> 
> Why does that matter?  (and you can use the reverse)
>  
> > When you implement a RESTful Web API you want to modify the bug by
> > POSTing/PUTing to its URL and not to the URL of some other resource
> > (EntryPoint).

It matters if you don't take it out of context by separating it from the second sentence. Assume you have a bug whose representation looks something like this:

  {
     "@id": "/bugs/1",
     "@type": "Bug",
     "resolved": false,
     ...
     "potentialAction": "actions/ResolveBugAction"
  }

You could then easily mark it as resolved by PUTing the following representation to /bugs/1

  {
     "@id": "/bugs/1",
     "@type": "Bug",
     "resolved": true,
     ...
  }

How can you describe that with the current Actions design? If I understood you correctly, your proposal was to change the bug's representation to something like

  {
     "@id": "/bugs/1",
     "@type": "Bug",
     "resolved": false,
     ...
     "potentialAction": "/actions/resolve-bug-action"
  }

How would you define that action? Could you please complete the template below

  {
     "@id": "/actions/resolve-bug-action ",
     "@type": "ResolveBugAction",



  }
  
There are two options I see regarding the target of the action. One is to use a URL template which consists of just a variable that is then substituted with the bug's URL. However, unless I missed something in [1], that's not possible. The alternative would be to use the reverse of "target" to point to the action (which effectively turns the bug into an EntryPoint). That effectively turns it to the equivalent of Hydra's "operation" property.


[1] https://www.w3.org/wiki/images/1/10/PotentialActionsApril11.pdf


--
Markus Lanthaler
@markuslanthaler

Received on Wednesday, 21 May 2014 20:21:33 UTC