New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Relationship self Link #42
Add Relationship self Link #42
Conversation
…ayload doesn't have a link.
@rgant Could you please just add a bit of a description here of the problem/use case that this solves? I assume that what was missing was a way of knowing where the actual resource/object came from on the Json-Api side. this is useful so that we can post back to it etc... without having to assume anything about where it came from. Therefore GETS POSTS, PATCHS and DELETES, can be directed there. Thanks for your help, appreciated as always!! |
JSONAPI supports managing the relationships between objects directly: http://jsonapi.org/format/#crud-updating-relationships This exposes that URL to the JavaScript code so we can use the URL for making updates:
There doesn't seem to be an obvious way to setup a "relationship" resource with js-data and js-data-jsonapi so I am still working on an optimal solution for that. But I know I will need the self relation URL to accomplish it. |
Ok, so the effect of updating, adding or removing a foreign key value in js-data, for example should result in a POST, PATCH or DELETE to the relationship's self link would be the end goal |
Sometimes yes. It depends on if we are just modifying the list, or adding new resources. |
This patch will add self links to the relationships in the metadata. It also checks that the URLs are defined in the JSONAPI payload before adding to the metadata.
This will result in things like: