title: REST API Creation of Multiple Resources
body: <p>I am currently working with an API where a POST request may create multiple resources, depending on the resource being passed. To give you an example, I have a <code>Reservation</code> resource, and two child resources, <code>Ancillary</code> and <code>SpecialRequest</code>. A reservation is uniquely identified by an alphanumeric string of 6 characters, and an <code>Ancillary</code> is identified by a unique ID within the reservation (i.e. ancillary IDs are only known to the parent reservation).</p>
  <p>So, to create an Ancillary, my API endpoint looks like this:</p>
  <p><code>POST /reservations/{reservationId}/ancillaries/</code></p>
  <p>Usually REST states that the resource being created (<code>Ancillary</code> in this case) is the resource that should be returned. However, my use-case is somewhat more complicated than that, since the reservation system which my API is interfacing with is legacy, and is somewhat unpredictable.</p>
  <p>There are certain ancillaries (bundles) which actually create <em>multiple</em> ancillaries. For example, an ancillary might be a package of two other ancillaries, which costs less than if you had to purchase the other two ancillaries. Moreover, an ancillary might also be linked automatically to a <code>SpecialRequest</code>.</p>
  <p>I'm wondering what my options are ... so far I've come up with the following:</p>
  <ol>
  <li>Return the entire <code>Reservation</code>, which is sure to include all sub resources which were created and/or modified as a result of the Ancillary creation. This is the &quot;safest&quot; option, but in doing so I wouldn't be able to tell the user which <code>Ancillary</code>s were created.</li>
  <li>Return only the <code>Ancillary</code> which was created, however this approach is likely make my API less usable since the API user is extremely likely to perform a <code>GET /reservations/{reservationId}</code></li>
  <li>Return a <code>Ancillary[]</code> regardless of the ancillary type, although this still leaves out the link between the <code>Ancillary</code> and the <code>SpecialRequest</code>.</li>
  </ol>
  <p>Thanks in advance for your thoughts and input</p>