I am still not sure how one should go about it with Yii default implementation of REST.
Say we have two models, Post and Category and a post can have multiple categories.
When creating a post, should we send a POST request to /posts and in the request body embed the categories, such as:
POST /posts
{"title": "the title", "body": "the body", "categories": ["category 1", "category 2"]}
Or should we send two separate requests, i.e:
POST /posts
{"title": "the title", "body": "the body"}
# this responds with {"id": 12345}
Then we send the categories
POST /posts/12345/categories
["category 1", "category 2"]
I personally think the second one makes more sense, however, Yii has no support for working like this, so i would have to basically do all the work myself to support this.
Any ideas?