Re: [Specifications] CreateAction with HTTP PUT

To address the issue of how the client "knows" that the said `PUT` operation actually adds members to the parent collection, there are two hints: `"schema:CreateAction"` and the hypothetical link relation `hydra:addMember`. 

In addition, as I mentioned in the call, we could have extra metadata on the operation itself. Something like:

``` json
{
  "@type": ["hydra:Operation", "schema:CreateAction"],
  "hydra:sideEffects": [{
    "@type": "hydra:AddLinkEffect",
    "property": "hydra:member",
    "subject": "/api/events"
  }]
}
```

Something like that? A `side-effects` block which can be used as an extension point for goal-oriented clients to describe how any operation affects other resources. In this example the `AddLinkEffect` (excuse poor naming) could describe the a `/api/events hydra:member _:new_memer` triple will be created.

Similarly it could describe that a `DELETE` operation on resource will remove it from other collections. Going back to the Vimeo example we could have

``` json
{
  "@id": "/users/elfpavlik/likes/144522067",
  "operation": {
    "@type": ["hydra:Operation", "schema:DeleteAction"],
    "hydra:sideEffects": [{
      "@type": "hydra:BreakLinkEffect",
      "property": "hydra:member",
      "subject": "/users/elfpavlik/likes"
    }, {
      "@type": "hydra: BreakLinkEffect",
      "property": "hydra:member",
      "subject": "/videos/144522067"
    }]
  }
}
```

Such extension point would allow various built-in and API-specific ways to describe what the operation does.

-- 
GitHub Notification of comment by tpluscode
Please view or discuss this issue at https://github.com/HydraCG/Specifications/issues/141#issuecomment-337008067 using your GitHub account

Received on Monday, 16 October 2017 19:29:46 UTC