title: RESTful API and calling remote methods (RPC)
body: <p>So i'm doing a bit of research on RESTful APIs and i'm trying to get some clarification on how to call methods on resources (essentially RPC).</p>
  
  <p>So if I wanted to call a method (cancel) on a resource (an order), from what I can see so far I can do it one of two ways:</p>
  
  <pre><code>POST /api/1/orders/123/cancel { }
  </code></pre>
  
  <p>or </p>
  
  <pre><code>POST /api/1/orders/123 { 'action' : 'cancel' }
  </code></pre>
  
  <p>Hopefully that makes sense?</p>
  
  <p>Personally I like the former more, you can just type out the url and call the method, the later requires a little extra work with POST params. Any params required by the method would go inside the POST?</p>
  
  <p>I guess a 3rd is by doing:</p>
  
  <pre><code>PATCH /api/1/orders/123 { 'state' : 'cancelled' }
  </code></pre>
  
  <p>But I'm trying to keep an order's (object's) fields and methods separate.</p>