title: REST resource related data
body: <p>I've created a REST API and I think I'm stuck with a RESTful issue. </p>
  
  <p>It's related with the following questions:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/7460934/best-practices-in-retrieving-related-data-in-a-rest-api">retrieving related data</a></li>
  <li><a href="https://stackoverflow.com/questions/2204509/rest-interface-usage-for-multiple-resources">multiple resources</a></li>
  </ul>
  
  <p>I have a resource called "cases". Cases have also related data, like users and messages.
  The problem is that I want to get the related queried users and messages data from a case, but I'm not sure with the URI design. There are also different kinds of related/calculated data. These related data should be used to create data visualization.</p>
  
  <p>How I get cases/users/messages are RESTful though:</p>
  
  <pre><code>http://example.com/cases (and with id for a single case)
  http://example.com/cases/{id}/users (same idea as above)
  http://example.com/cases/{id}/messages (same idea as above)
  </code></pre>
  
  <p>My first thoughts to create related resources are (I think URI looks wrong, it's maybe getting a bit RPC?):</p>
  
  <p>Related data 1:</p>
  
  <pre><code>http://example.com/cases/{id}/analysis/messages-network-traffic
  
  {
      "sender": "an user jack", 
      "receiver": "an user steph", 
      "amount_messages": 51
  }, 
  {
      "sender": "an user test", 
      "receiver": "an user test4", 
      "amount_messages": 3
  }
  ...
  </code></pre>
  
  <p>Related data 2:</p>
  
  <pre><code>http://example.com/cases/{id}/analysis/messages-timeline?receiver=testuser1&amp;sender=testuser2
  {
      "amount_messages": 24, 
      "timestamp": 1387321576
  }, 
  {
      "amount_messages": 50, 
      "timestamp": 1387321576
  }
  ...
  </code></pre>
  
  <p>Are these correct thinking of URI design (I think it's kind of RPC though), or how should I do?
  Because I don't see any reason to CREATE a report resource like the related questions. The data is just a calculation of the existing resources.</p>
  
  <p>Thank you in advance.</p>