title: REST API returning object after POST
body: <p>I am creating a REST API and am currently facing a dilemma about return value after a successful POST request to my API.</p>
  
  <p>Objects I am working with are the following:</p>
  
  <ul>
  <li><code>Service</code> (some service that is requested by user);</li>
  <li><code>ServicePriceSelection</code> (prices offered for the Service);</li>
  <li><code>Booking</code> (Service <em>with defined price</em> that has been paid for).</li>
  </ul>
  
  <p>After user POSTs object data to <code>/api/service</code> not only new <code>Service</code> object is created, but also The <code>ServicePriceSelection</code>. The user needs the data contained in <code>ServicePriceSelection</code> to display the prices and other information.</p>
  
  <p>So the question which of the following would be the correct way to handle the situation:</p>
  
  <ol>
  <li>Return status 201 and resource IDs of new <code>Service</code> and <code>ServicePriceSelection</code>. User would need to make GET request to <code>/api/service/{id}</code> and <code>/api/service/service-price-selection/{id}</code> to get the data.</li>
  <li>Return status 201 and resource ID of new <code>Service</code> and resource ID and all data for new <code>ServicePriceSelection</code>. User would not need to make another request to get the data, but I am not sure if this is correct based on RESTful principles.</li>
  </ol>
  
  <p>Server side programming language - PHP (Yii2 framework).</p>