title: What to use PATCH or POST?
body: <p>I had a quiet long debate with my colleague about the proper HTTP verb to be used for one of our operation that changes the STATE of a resource.</p>
  
  <p>Suppose we have a resource called <code>WakeUpLan</code> that tries to send event to a system connected in a network. This is kind of a Generic State Machine,</p>
  
  <pre><code>{
  id: 1,
  retries: {
   idle: 5, // after 5 retries it went to FAILED state
   wakeup: 0,
   process: 0,
   shutdown: 0
  },
  status: 'FAILED',
  // other attributes
  }`
  </code></pre>
  
  <p><code>IDLE --&gt; WAKEUP ---&gt; PROCESS ---&gt; SHUTDOWN</code> <code>|</code> <code>----&gt;</code> <code>[FAILED]</code></p>
  
  <p>Every state has a retry mechanism, i.e in <code>IDLE</code> case it tries for <code>x</code> times to <code>transition</code> to <code>WAKEUP</code> and after <code>x</code> retries it dies out and goes to <code>FAILED</code> state.</p>
  
  <p>All the <code>FAILED</code> resource can be again manually restarted or retried one more time from some interface.</p>
  
  <p>So, we have a confusion regarding which HTTP verb best suits in this case.</p>
  
  <p>In my opinion, it is just a change in <code>status</code> and resetting retry count to 0, so that our retry mechanism can catch this and try in next iteration.
  so it should be a pure <code>PATCH</code> request </p>
  
  <p><code>PATCH retry/{id}</code>
  <code>{state: 'IDLE'}</code></p>
  
  <p>But my colleague opposes it to be a POST request as this is a pure action and should be treated as POST.
  I am not convinced because we are not creating any new resource but just updating existing resource that our REST server already knows about it.</p>
  
  <p>I would like to know and corrected if I am wrong here.</p>
  
  <p>Any suggestions/advices are welcome.</p>
  
  <p>Thanks in advance.</p>