Closed Tronix117 closed 7 years ago
That is just for convenience since it is not a specification of JsonAPI, however it can be useful with some specific backends.
The idea is to give an forceRelationshipsInAttributes: true option to the save or the update.
forceRelationshipsInAttributes: true
PATCH /articles { "data": { "type: "Article", "id": "xxx-xxx-xxx", "attributes": { "title": "New title" }, "relationships": { "author": { "data": { "type": "User", "id": "yyy-yyy-yyy" } } } } }
PATCH /articles { "data": { "type: "Article", "id": "xxx-xxx-xxx", "attributes": { "title": "New title", "authorId": "yyy-yyy-yyy" } } }
Ref #21, it has been evoked in the comments
That is just for convenience since it is not a specification of JsonAPI, however it can be useful with some specific backends.
The idea is to give an
forceRelationshipsInAttributes: true
option to the save or the update.Without the option:
With the option:
Ref #21, it has been evoked in the comments