title: REST/HATEOAS - Available methods in HAL links
body: <p>I am looking at defining a REST API using <a href="https://en.wikipedia.org/wiki/HATEOAS" rel="noreferrer">HATEOAS</a>. In particular, I find very interesting the concept of indicating for a given resource the actions that are available right now.</p>
  
  <p>Some of the HATEOAS specifications include too much overhead for my needs, so I was looking at the <a href="https://tools.ietf.org/pdf/draft-kelly-json-hal-08.pdf" rel="noreferrer">HAL specification</a>, as I find it very concise and practical:</p>
  
  <pre><code>{
      _links: {
          self: { href: "/orders/523" },
          warehouse: { href: "/warehouse/56" },
          invoice: { href: "/invoices/873" }
      },
      currency: "USD",
      status: "shipped",
      total: 10.20
   }
  </code></pre>
  
  <p>However, links in HAL only contain a list of related resources, but not the available actions on them. As per the example above, am I allowed to cancel the order now, or not anymore? Some HAL examples solve this by using a specific URL for cancellations, and add a corresponding link in the response only if cancellation is possible:</p>
  
  <pre><code>"cancel": { "href": "/orders/523/cancel" }
  </code></pre>
  
  <p>But that is not very RESTful. Cancellations are not a resource. Cancellations are a DELETE of a resource, i.e.:</p>
  
  <pre><code>DELETE /orders/523
  </code></pre>
  
  <p>Is there a nice way to represent this with HAL, or should I use a different HATEOAS specification?</p>
  
  <p>I am considering returning a "cancel" link with the same URL as self, but in this case the client would have to know that to cancel they have to use the DELETE verb, which is not really being described in the HATEOAS response.</p>
  
  <pre><code>self: { "href": "/orders/523" },
  cancel: { "href": "/orders/523" }
  </code></pre>
  
  <p>Would this be the recommended approach as per HATEOAS / HAL? I understand HAL does not have any "method" parameter, and adding it myself would be against the HAL specification.</p>