1

to get a related entities using the json:api I can use ex: ?include=uid,uid.user_picture in the parameter, and all the related entities will be returned in the included object, then the front application needs to apply some logic to get the entity(ex: node)+ related entity fields (ex: author email) and then I want to get the author is image , so the front will need to handle a lot of loops, so I have used the JSON:API Include module it works by embeding the relationships one inside another automaticall,but it have some drawbacks so can any one help me to figure out what is the best solution ?

  1. without JSON:API Include module :

    the json HTTP response size will be smaller,also the json structure respect the JSON API specification which make it more stable and understandable(relationships , included..) but the processing in the front application will be heavier if we have a lot of relationships.enter image description here

  2. with JSON:API Include module :

    easy processing for the front application but the json HTTP response size will be bigger ,and the JSON:API specification will be broken(no relationships or included object all will be shifted into the data object).enter image description here

2
  • use it if you need simplified results to be used in the front end – Jothi Kannan Feb 13 '20 at 10:44
  • i'm the author of JSON:API Include, when you use module the front end developer will happy and save a lot of time ;) – flashvnn Mar 10 '20 at 4:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.