AE
Ash Elixir•3y ago
sisk

Json Api

Say I have two resources user and profile. relationship being profile belongs to user. when iam returning user resource how can i return it along with the profile as response from get request?. i have a read action that works well and return data as expected via iex. however if i use the same action on json api, i only recieve user data without profile data. can someone guide me?
2 Replies
ZachDaniel
ZachDaniel•3y ago
This is described in the json:api specifications: https://jsonapi.org/format/#fetching-includes Then, in your json_api configuration for user you'd add a includes [:profile] to allow passing ?include="profile"
sisk
siskOP•3y ago
thank you all is working well now 😀

Did you find this page helpful?