Problem/Motivation

Now that the entity index resource is becoming more flexible (via #2537968: Improve flexibility of entity index resources), it would be really nice if we could optionally get back fully loaded entities from an index resource call. Often times an app may want a handful of nodes, but calling node retrieve multiple times isn't the best for network performance and # of requests to the server.

Proposed resolution

&options[entity_load]=true

Using the new $options parameter on the entity index resource implementations, look for a boolean option called entity_load that when set will instead use entity_load() to get the results (after applying any index conditions, orderby, etc).

We would need to put limitations on this for performance reasons (i.e. no unlimited queries, etc). We would also want to run the results through the access/permission services_* functions (e.g. services_field_permissions_clean) to cleanse the results appropriately.

The default behavior (and FALSE behavior) will continue as usual and do a normal index query.

=============

I'll be implementing this relatively soon, and want to know if there are any objections/suggestions to this. I do feel this is inline with an @todo in the node_resource.inc file:

* @todo
* Evaluate the functionality here in general. Particularly around
* - Do we need fields at all? Should this just return full nodes?
* - Is there an easier syntax we can define which can make the urls
* for index requests more straightforward?

Comments

tyler.frankenstein created an issue. See original summary.

tyler.frankenstein’s picture

Issue summary: View changes
tyler.frankenstein’s picture

Status: Active » Needs review

The initial implementation for this is here and working: https://github.com/signalpoint/services/commit/b3b0ebe7a26467c91d785c1e1... - I'll look to file a pull request for this once some folks chime in whether or not they like this approach.

kylebrowning’s picture

Status: Needs review » Reviewed & tested by the community

I like it. Lets do it if you're still up for it.

jacob.embree’s picture

I've been using this for quite some time.
The link above is broken. Here's a replacement: https://github.com/kylebrowning/services/commit/b3b0ebe7a26467c91d785c1e...