title: What is the proper HTTP method for modifying a subordinate of the named resource?
body: <p>I am creating a web client which has the purpose of modifying a set of database tables by adding records to them and removing records from them. It must do so atomically, so both deletion and insertion must be done with a single HTTP request. Clearly, this is a write operation of some sort, but I struggle to identify which method is appropriate.</p>
  <p><strong>POST</strong> seemed right at first, except that <a href="https://www.rfc-editor.org/rfc/rfc2616#section-9.5" rel="nofollow noreferrer">RFC 2616 specifies</a> that a POST request must describe &quot;a new subordinate&quot; of the named resource. That isn't quite what I'm doing here.</p>
  <p><strong>PUT</strong> can be used to make changes to existing things, so that seemed about right, except that <a href="https://www.rfc-editor.org/rfc/rfc2616#section-9.6" rel="nofollow noreferrer">RFC 2616 also specifies</a> that &quot;the URI in a PUT request identifies the entity enclosed with the request [...] and the server MUST NOT attempt to apply the request to some other resource,&quot; which rules that method out because my URI does not directly specify the database tables.</p>
  <p><strong>PATCH</strong> seemed closer - now I am not cheating by only <em>partly</em> overwriting a resource - but <a href="https://www.rfc-editor.org/rfc/rfc5789#section-2" rel="nofollow noreferrer">RFC 5789 makes it clear</a> that this method, like PUT, must actually modify the resource specified by the URI, not some subordinate resource.</p>
  <p>So what method should I be using?</p>
  <p><strong>Or, more broadly for the benefit of other users:</strong></p>
  <p>For a request to X, you use</p>
  <ul>
  <li><a href="https://www.rfc-editor.org/rfc/rfc2616#section-9.5" rel="nofollow noreferrer">POST</a> to create a new subordinate of X,</li>
  <li><a href="https://www.rfc-editor.org/rfc/rfc2616#section-9.6" rel="nofollow noreferrer">PUT</a> to create a new X,</li>
  <li><a href="https://www.rfc-editor.org/rfc/rfc5789#section-2" rel="nofollow noreferrer">PATCH</a> to modify X.</li>
  </ul>
  <p>But what method should you use if you want to modify a subordinate of X?</p>