RESTful API and real life example
<p>We have a web application (AngularJS and Web API) which has quite a simple functionality - displays a list of jobs and allows users to select and cancel selected jobs.</p>

<p>We are trying to follow RESTful approach with our API, but that's where it gets confusing.</p>

<p>Getting jobs is easy - simple <code>GET: /jobs</code></p>

<p>How shall we cancel the selected jobs? Bearing in mind that this is the only operation on jobs we need to implement. The easiest and most logical approach (to me) is to send the list of selected jobs IDs to the API (server) and do necessary procedures. But that's not RESTful way.</p>

<p>If we are to do it following RESTful approach it seams that we need to send PATCH request to <code>jobs</code>, with json similar to this: </p>

<pre><code>PATCH: /jobs
[
    {
      "op": "replace",
      "path": "/jobs/123",
      "status": "cancelled"
    },
    {
      "op": "replace",
      "path": "/jobs/321",
      "status": "cancelled"
    },
]
</code></pre>

<p>That will require generating this json on client, then mapping it to some the model on server, parsing <code>"path"</code> property to get the job ID and then do actual cancellation. This seems very convoluted and artificial to me. </p>

<p>What is the general advice on this kind of operation? I'm curious what people do in real life when a lot of operations can't be simply mapped to RESTful resource paradigm.</p>

<p>Thanks!</p>