diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/Derivative/EntityDerivative.php b/core/modules/rest/lib/Drupal/rest/Plugin/Derivative/EntityDerivative.php
index 310d843..7ae9009 100644
--- a/core/modules/rest/lib/Drupal/rest/Plugin/Derivative/EntityDerivative.php
+++ b/core/modules/rest/lib/Drupal/rest/Plugin/Derivative/EntityDerivative.php
@@ -44,6 +44,9 @@ public function getDerivativeDefinitions(array $base_plugin_definition) {
           'id' => 'entity:' . $entity_type,
           'entity_type' => $entity_type,
           'serialization_class' => $entity_info['class'],
+          'serialization_context' => array(
+            'entity_type' => $entity_type,
+          ),
           'label' => $entity_info['label'],
         );
         $this->derivatives[$entity_type] += $base_plugin_definition;
diff --git a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php
index 77bcc00..52bd795 100644
--- a/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php
+++ b/core/modules/rest/lib/Drupal/rest/Plugin/rest/resource/EntityResource.php
@@ -25,6 +25,9 @@
  *   id = "entity",
  *   label = @Translation("Entity"),
  *   serialization_class = "Drupal\Core\Entity\Entity",
+ *   serialization_context = {
+ *     "entity_type" = "entity"
+ *   },
  *   derivative = "Drupal\rest\Plugin\Derivative\EntityDerivative"
  * )
  */
diff --git a/core/modules/rest/lib/Drupal/rest/RequestHandler.php b/core/modules/rest/lib/Drupal/rest/RequestHandler.php
index 8a23b50..1a21d69 100644
--- a/core/modules/rest/lib/Drupal/rest/RequestHandler.php
+++ b/core/modules/rest/lib/Drupal/rest/RequestHandler.php
@@ -55,8 +55,17 @@ public function handle(Request $request, $id = NULL) {
       if (empty($enabled_formats) || isset($enabled_formats[$format])) {
         $definition = $resource->getDefinition();
         $class = $definition['serialization_class'];
+
+        // Get context information for deserialization from the plugin
+        // definition.
+        $context = array();
+        if (!empty($definition['serialization_context'])) {
+          $context = $definition['serialization_context'];
+        }
+        // Always add the resource ID to the deserialization context.
+        $context['resource_id'] = $id;
         try {
-          $unserialized = $serializer->deserialize($received, $class, $format);
+          $unserialized = $serializer->deserialize($received, $class, $format, $context);
         }
         catch (UnexpectedValueException $e) {
           $error['error'] = $e->getMessage();
