title: RESTful API: What should a collection URL return?
body: <p>Let's say I have a database with customers and their orders. Each customer has general information like name, address, etc. Each order has information on items purchased, amount paid etc. The database is exposed through a RESTful API. </p>
  
  <p>Presumably, a GET on a RESTful API URL like </p>
  
  <pre><code>/customers/101/orders/47/
  </code></pre>
  
  <p>would be expected to return the info (items purchased, amount paid, etc) for order 47 by customer 101. </p>
  
  <p>I presume also that a GET on the following URL:  </p>
  
  <pre><code>/customers/101/orders/
  </code></pre>
  
  <p>would be expected to return the information on all orders by customer 101.</p>
  
  <p>However, what should a GET on the following URL return?</p>
  
  <pre><code>/customers/101/
  </code></pre>
  
  <ul>
  <li>Should it return all orders by customer 101?</li>
  <li>Should it return just the name, address, etc of customer 101?</li>
  <li>Should it return all orders by customer 101 <em>and</em> their name, address etc?</li>
  </ul>
  
  <p>My question obviously assumes that there is a "right answer" or recommended best practice for what RESTful API URLs should return. </p>