Creating a node via REST - Entity reference field value not updating I'm trying to create a node on a Drupal 8 site via REST. Passing all the values to create the fields work fine apart from the field that is an entity reference field. The field is an entity reference to Drupal users. Drupal creates the node, there is no validations errors, but the entity reference field has no value. I've tried changing 'target_id' to 'value', same thing, the node gets created without errors but no value is given to the user entity reference field.

Any ideas?

$serialized_entity = json_encode([
    'title' =&gt; array(
      'value' =&gt; 'some_title',
    ),
    'type' =&gt; array(
      'target_id' =&gt; 'node_type',
    ),
    '_links' =&gt; array(
      'type' =&gt; array(
        'href' =&gt; $base_url . '/rest/type/node/node_type',
      ),
    ),
    'entity_reference_field' =&gt; array(
      'target_id' =&gt; $entity_id, // This does not work. Using a valid uid.
    ),
    'normal_field' =&gt; array(
      'value' =&gt; 'some_data',
    ),
]);
I managed to get working by changing this...

'entity_reference_field' =&gt; array(
  'target_id' =&gt; $entity_id,
),


to this...

'entity_reference_field' =&gt; array(
  array('target_id' =&gt; $entity_id),
),


I also had to disable using an entity reference view as the 'Reference type' on the field and just have the option as 'Default'. Not sure if this is a bug or if there's something wrong with my entity reference view.