This project is not covered by Drupal’s security advisory policy.

RESTful Web Services doesn't recursively populate entity references with entity objects. Rather, entity references are entity id+type stubs. This hooks into the construction of the services' response data to populate entityreference fields with their respective fully-loaded entity.

This feature request in restws was first reported by btopro in #2024603: Pull more then just item id when using references (code snippet) and then again by JamesAn in #2394869: Return entity reference fields recursively as full-fledged entity objects. The code snippet in #2024603: Pull more then just item id when using references (code snippet) forms the basis of this module.

This module only works for JSON output (e.g. endpoints like

For Drupal installations using Aegir 7.x-3.x running on nginx, Aegir's default nginx configuration file prevents URLs ending in .json from being fed into Drupal (i.e. it tries and fails to find and serve a json file located at the URL's resolved path, throwing a 404 HTTP error). The location directive located in lines 279-293 of config/includes/nginx_vhost_common.conf (relative to the Aegir user's home directory) needs to be commented out to resolve this issue. It shouldn't be too difficult to augment this directive to attempt loading an actual JSON file and gracefully degrade to bootstrapping Drupal in the case of a 404 to allow loading of files with a .json extension and using Drupal with paths ending in .json. In the event of collisions between JSON file paths and Drupal routing paths, the augmentation would serve the JSON file and not bootstrap Drupal (e.g. if there was a file located at /srv/www/node/18.json and Drupal was set up to serve the path

  • It also does not yet load the referenced entity's entity references.
  • Recursive reference traversal/loading is a planned feature.
  • Parameterised control of which types of entities/bundles and how deep to load are also planned.
  • Safety features like detecting cyclic reference graphs and max-depth-bounded traversal are also planned.
Supporting organizations: 

Project information