title: RESTful Many-to-Many possible?
body: <h1>How to I represent a complex resource for a REST post?</h1>
  
  <p>Hello,
  Currently I have an application which when the user hits "save" it iterates over all of the form elements and creates one mass object which manages a:</p>
  
  <pre><code>  var = params = [{ 
     attributes1: form1.getValues(),
     attributes2: form2.getValues(),  
  .. ..
  }];
  </code></pre>
  
  <p>I then send this mass object via a RPC POST to my "Entity" model service. 
  This entity which I wish to persist data for is quite complex. All in all, the data is spread accross about 30 tables. To help explain my actual question, the "entity" is a building (as in a physical property/house/apartment). </p>
  
  <p>What I would like, is to be able to turn my mess into a RESTful API for saving properties. 
  The problem I have is that, saving details for a single model that spans a single table is fine. How do I structure my data object for transport when the model has</p>
  
  <ul>
  <li>many to many relationships</li>
  <li>one to many relationships</li>
  <li>one to one relationships</li>
  </ul>
  
  <p>For example:</p>
  
  <p>Here is a WATERED down version of what I might have on a property and the sample data</p>
  
  <pre><code>propertyId: 1,
  locationId: 231234,
  propertyName: "Brentwood",
  kitchenFeatures: [
               { featureId: 1, details: "Induction hob"},
               { featureId:23, details: "900W microwave"}
  ],
  propertyThemes: [ 12,32,54,65 ]
  </code></pre>
  
  <p>This actually goes on a lot more.. but you can get the general gist. <code>kitchenFeatures</code> would be an example of a many-to-many, where I have a featuresTable which has all of the features like so:</p>
  
  <pre><code>`featureId`, `feature`
  1             "Oven Hob"  
  23            "Microwave"
  </code></pre>
  
  <p>and propertyThemes would be an example of another many-to-many.</p>
  
  <p>How am I expected to form my "object" to my RESTful service? Is this even possible? </p>
  
  <p>ie. If I want to save this property I would send it to:</p>
  
  <p><code>http://example.com/api/property/1</code></p>