I am trying to import nodes from a different domain's REST export view. I am able to get all serialized nodes from the view through Guzzle but once I try to create a node from the hal+json response I get this error:

Type http://drupaltest.dev/rest/type/node/article does not correspond to an entity on this site

This is the code I'm using to create the node:

$data = $request->getBody();
$output = \Drupal::service('serializer')->decode($data, true);

$entity = \Drupal::service('serializer')->denormalize($output[5], Node::class, 'hal_json');

Any ideas how to create the node? Using only json instead hal+json works but does not give me the entity relationships.


Alright, so it seems I needed to replace all references to the source site with the receiving website. But the denormalization step does not create entities referenced by the selected node (I'm most interested references to images). Any suggestions?


You need to set your rest permissions for articles/nodes such that the user you are using can create and view them. I'll update this answer with paths when I'm back at a computer.

  • Hey, thanks, but permissions are not the problem here – I already tried changing them with no effect. Check the error message, it has to do with denormalizing because it says the entity type does not exist. Also it works when I change the format to JSON – alexej_d May 22 '16 at 9:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.