tgpfeiffer / restful-openerp

36 stars 13 forks source link

Allow to specify “depth” when querying resources #7

Open tgpfeiffer opened 11 years ago

tgpfeiffer commented 11 years ago

It would be nice to be able to see the data of related objects (like, res.partner details when looking at a sale.order object) instead of just the <link> tag by specifying a depth parameter somewhere in the request, for example in the Accept header, as described at http://www.stereoplex.com/blog/mobile-api-design-thinking-beyond-rest. A resource queried with depth=1 could then look like this:

<entry xmlns="http://www.w3.org/2005/Atom">
  ...
  <content type="application/vnd.openerp+xml">
  <product_product xmlns="http://localhost:8068/erptest/product.product/schema">
    ...
    <ean13 type='char'>9783540853305</ean13>
    <company_id type='many2one'>
      <res_company xmlns="http://localhost:8068/erptest/res.company/schema" href='http://localhost:8068/erptest/res.company/1'>
        <name>My Company</name>
        ...
      </res_company>
    </company_id>
    ...
  </product_product>
  </content>
</entry>