Creating nested resources format?

what’s that creating nested resources format. typically how is json format when oneToMany associated models?

i think:
{
“data”: {
“type”: “posts”,
“attributes”: {
“title”: “Ember Hamster”,
“src”: “http://example.com/images/productivity.png
},
“relationships”: {
“comments”: {
“data”: [
{“type”: “comments”, attributes: { text: “some comment”} },
{“type”: comments, attributes: {text: “some comment”} }
}
}
}
}

Right now, you can’t create more than one resource (i.e. a post with it’s comments) in a single request. However, this is going to be supported soon. See https://github.com/json-api/json-api/issues/795

1 Like