title: REST - Partial Resources
body: <p>It's common in a REST design to allow partial resources to be returned. In this case; I want to allow the user specify only certain fields of a resource to be returned in the JSON representation of that resource.</p>
  
  <p>For example lets say we have a resource Person:</p>
  
  <pre><code>{
     "id": 12,
     "name":{
            "first":"Angie",
            "last": "Smith",
            "middle": "joy",
            "maiden": "crowly",
      },
      "address": {
            "street": "1122 Something St.",
            ..and so on...
      },
  ... and so on
  }
  </code></pre>
  
  <p>Lets say that list of params is pretty long.  And lets say I have an API consumer who at the beginning of creating the API design wants only a couple fields like id and name.first back.  I'm assuming it's common to allow something like this:</p>
  
  <p>/person?fields=id,name</p>
  
  <p>where fields says I only want those fields back.</p>
  
  <p>The question I have is, should then the Person resource return all fields with nulls and just those fields with values OR should it just return the Person representation with only fields id and name and you literally remove all the other params dynamically from the backend.</p>
  
  <p>Seems like #2 is cleaner, but does it make sense to do that in REST, or do people normally return all other fields (to make sure we're keeping the representation in terms of structure/schema consistent/reliable) with nulls?</p>