Restful Api With Related Tables

Hi to all am developing restful apis for my existing yii web and this websites contains information with related tables. For example getting a blog post with their related comments in a json object. Is it good to do it at the server side and get everything in a json object or each resource has to be a single request and relate them at the client side. Please if you have an example share it.

I guess both design decissions are equally good. But depending on how the API is going to be used i would prefer one over the other.

Say the API is exposed to a crawler which can use it to crawl your post and analyze it in a semantic way, i.e. the crawler knows that there are comments which belongs to a post etc…

Then the correct way would be to deliver the JSON response as a document, containing the blog post AND its comments.

But if the API is exposed to visitors of your blog, I would think that the more appropriate way would be to deliver one json object for each resource.

Its just depending on how you want to use that API later.

[color="#006400"] /* moved from Extensions */[/color]