Skip to main content

You have been working hard on getting comments being added (POST) through REST in Drupal 8.  However, now you are seeing the following Assigning the wrong user against a new comment - and most likely the new comment is being assigned to the site admin.  

The error here is related to the _embedded uuid.

What to do

You need to check that you have the correct uuid for both the entity_id and the uid

  • entity_id - "http://example.local/rest/relation/comment/comment/entity_id";
  • uid - "http://example.local/rest/relation/comment/comment/uid"


  "_embedded": {
    "http://example.local/rest/relation/comment/comment/entity_id": [{
        "uuid": [{"value": "8795cd5d-d223-4cad-9373-605c8ffac10f"}]
    "http://example.local/rest/relation/comment/comment/uid": [{
        "uuid": [{"value": "a8c95c05-4546-4c7b-def5-fed7a4c5beca"}]

Want to see the request body in full - go to Drupal 8 REST POST comments

Testing this, I found that you can change the entity_id value (in this example 2) then the line becomes


so the entity_id is set to the correct node.nid value that you want to comment posted too.  If the uuid points to a different entity_id then the comment will be assigned to entity of the uuid in the _embedded area.  

This also applies to the "http://example.local/rest/relation/comment/comment/uid"