Custom resources: load entity by uuid I have created a custom resource which extends the EntityResource class. This way I can use all build in functionality that Drupal core provides on the default entity resource, but I can still add some extra checks. This works perfectly fine.

I defined my canonical route in my resource as /api/my-endpoint/{node}. In this way, I can fetch and patch nodes by the node ID. After careful consideration, I want to implement /api/my-endpoint/{node_uuid} or even /api/my-endpoint/{node_custom_field} to fetch (and patch) a node by UUID. 

Of course, Drupal doesn't know this param and cannot load the corresponding node object, which results in fatal errors.

How can make I this work?
I tried to implement a custom RoutingParamConverter class, but I didn't got it to work.
As long as you have the uuid of an entity you can use Drupal's entity storage interface to load it given that property. It should be as simple as using the loadByProperties method.

$node_loaded_by_uuid = \Drupal::entityTypeManager()-&gt;getStorage('node')-&gt;loadByProperties(['uuid' =&gt; $your_uuid]);
$node_loaded_by_uuid = reset($node_loaded_by_uuid);


UPDATE: milkovsky is correct. loadByProperties returns an array. If you want the actual node object at the top of it you will have to use the reset function.