title: Statelessness of a REST api with authenticated users
body: <p>I'm currently designing a REST Http api. (With HATEOAS stuff, to make clients "simpler", and avoid clients to do complicated things, instead of letting the api tell them what to do ...)</p>
  
  <p>Because of the social characteristic of the app, in order to interact with the application, users need to be authenticated, and each user will have a slighty different "view" of the data.
  We'll take twitter as an example, it will be easier for everyone.</p>
  
  <p>To authenticate users, we'll use OAuth, easy.</p>
  
  <p>So, in the client (ios app...), a random user would maybe seeing a list of users should see:</p>
  
  <pre><code>Adrien: Following
  John:   Not Following
  Rambo:  Not Following
  </code></pre>
  
  <p>And another user would maybe see:</p>
  
  <pre><code>Adrien: Following
  John:   Not Following
  Rambo:  Following
  </code></pre>
  
  <p>To achieve this, the first solution would be for the client (in oauth term, the iphone/web/etc app), to get a list of all the users the authenticated user follow, and each time the client displays a list, compare each user with the list of followed users to know if it should display "Not Following" or "Following".</p>
  
  <p>The requests/responses would be:</p>
  
  <pre><code>GET /users
  Authorization: OAuth token...
  
  [
    {"id": 1, "name": "Adrien"},
    {"id": 2, "name": "John"},
    {"id": 3, "name": "Rambo"}
  ]
  </code></pre>
  
  <p>and</p>
  
  <pre><code>GET /users/{myid}/following
  Authorization: OAuth token...
  
  [1, 3, 25, 1210, 9]
  </code></pre>
  
  <p>This seems to be quite, stateless. Good.</p>
  
  <p>Now what if i want to make client developers life easier, and embed directly in the user list response, the relationship of each user, relative to the authenticated user:</p>
  
  <pre><code>GET /users
  Authorization: OAuth token...
  
  [
    {"id": 1, "name": "Adrien", "relationship": "Following"},
    {"id": 2, "name": "John", "relationship": "Not Following"},
    {"id": 3, "name": "Rambo", "relationship": "Following"}
  ]
  </code></pre>
  
  <p><strong>So, questions:</strong></p>
  
  <ul>
  <li>It seems to break the "stateless" thing, does it really break the <strong>REST</strong> stateless constraint ?</li>
  <li>Next, do you think it is a good or bad practice for an api to do this ?</li>
  </ul>