0

My nodes of content type Article contain an entity reference to Audio media. This Audio media has a file entity reference.

When listing articles via JSON:API, I want to automatically include this file entity reference for any articles that have it.

To auto-include the Audio media entity reference, I can use the JSON:API Defaults submodule of the JSON:API Extras module to add audioMedia (JSON:API Extras customized name for the entity reference field pointing to Audio media).

However, I don't know how to auto-include the file entity reference, which is on the audioMedia entity reference.

I tried customizing the Audio media resource to include the file reference, but that includes it when accessing Audio media via JSON:API, not when accessing Articles.

I also tried adding file to the Default include list for Articles, but this gives an error that file is not an available option.

So how can I auto-include the entity reference of an entity reference with JSON:API Defaults?

1 Answer 1

0

Multi-level references need to be linked by a period:

audioMedia.file

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.