Closed raghubetina closed 2 years ago
You should get this out of the box if you add .json
to the url
@richmolj That's good to know! It works for a resource by itself, but I can't seem to get it working when relationships are included (because it's interpreting the .json
as another relationship to include, I think).
For example, in the sample application, visiting /api/v1/departments/1?include=teams.json produces an Graphiti::Errors::InvalidInclude
, 'The requested included relationship "json" is not supported.'
I tried adding some arbitrary parameters after include
but haven't gotten a working solution yet. Would appreciate any advice!
.json
comes before the ?
🤦🏾♂️ thank you!
Hi all,
I was hoping to teach non-programmers how to consume a Graphiti API with a no-code tool. Since they won't be writing any custom code in the client, it would be very helpful if the API response had the details of associated objects within the main resource itself — the way that Vandal previews it when you click "View as JSON":
Unfortunately (for our purposes), the actual JSON:API response has the associated data located far away (in
includes
), with only links and IDs directly withindata.relationships
.I'm trying to figure out how to customize the response to look the way it does within Vandal's "View as JSON" preview; i.e., with each associated object's details within
data.relationships
, rather than separately inincludes
. I assume that Vandal is doing it client-side?So far I think I may have to modify renderer.rb. If not, I was hoping someone could point me in the right direction.
Thank you!