RESTful-Drupal/restful — pull request #334 by mateu-aguilo-bosch (2014-12-22 09:45:57+00:00)
Title: Allow loading entities by any field.

I've found need this several times already. I need to be able to load an entity by a unique field or property attached to that particular entity.

This is the URL schema I'm looking for:

```
https://www.example.org/[resource-name]/[non-standard-id-value]?loadById=[non-standard-id-name]
```

At the same time we need to communicate to the API consumer that the canonical resource for what RESTful is returning is different. We should do that with a `Link` header and a `rel="canonical"` in the response. That is one of the REST principles that is really useful to normalize caches –among other things–.

### Real scenario
There's a _Segment_ content type that has a unique field. We want to be able to load by that ID.

```
https://www.example.org/segments/asdf-asdf-asdf-asdf?loadById=unique
```

Returns:
```
HTTP/1.1 200 OK
Date: Mon, 22 Dec 2014 08:08:53 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Alternate-Protocol: 80:quic,p=0.02
Transfer-Encoding: chunked
Link: https://www.example.org/segments/12; rel="canonical" <----

[RESPONSE BODY]
```