title: How to POST a derived entity to a base entity set
body: <p>Suppose I have a base entity type named Employee and a derived entity type named Manager. And the set of all Employees is accessible at the <code>/Employees</code> URL. What is the correct way to POST an instance of Manager to the Employees entity set?</p>
  
  <p>The <a href="http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part1-protocol/odata-v4.0-errata02-os-part1-protocol-complete.html#_Toc406398326" rel="nofollow">OData v4 protocol spec</a> says "To create an entity in a collection, the client sends a POST request to that collection's URL." But the spec does not say anything about specifying the type of the POSTed entity in a scenario where derived types exist.</p>
  
  <p>The <a href="http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398088" rel="nofollow">URI spec</a> says derived types should be addressed using a cast segment on the target URL. For example, </p>
  
  <pre><code>POST /Employees/NS.Manager
  { "Name": "Bill Lumbergh" ... }
  </code></pre>
  
  <p>Meanwhile, the <a href="http://docs.oasis-open.org/odata/odata-json-format/v4.0/errata02/os/odata-json-format-v4.0-errata02-os-complete.html#_Toc403940617" rel="nofollow">JSON Format spec</a> suggests using the <code>odata.type</code> annotation as follows: </p>
  
  <pre><code>POST /Employees
  { "@odata.type": "#NS.Manager", "Name": "Bill Lumbergh" ... }
  </code></pre>
  
  <p>So which is correct? Or are both?</p>
  
  <p>Please keep in mind that I am asking with respect to the OData specifications, not a specific OData library/framework (e.g. ASP.NET).</p>