Problem/Motivation

It's not clear how to POST a comment (and probably other entities having relations like book page, entity referenced entity).

Submitting a node by following the REST+HAL node POST on https://www.drupal.org/node/2098511 is running ok.

Trying to accomplish this for a comment fails with 422 Unprocessable Entity code without the build message by EntityResource::validate()

Adding throw new \RuntimeException($message); like

protected function validate(EntityInterface $entity) {
...
throw new \RuntimeException($message);
      throw new HttpException(422, $message);
    }
  }

reveils in apache error log in my case shows

Uncaught PHP Exception RuntimeException: "Unprocessable Entity: validation failed.\nentity_id: This value should not be null.\n" at /.../core/modules/rest/src/Plugin/rest/resource/EntityResource.php line 214

What must I do now?

Proposed resolution

This needs documentation and debugging tools for REST client builders.

Remaining tasks

Collateral issue:

  • Is Symfony in err not using getMessage()? File a bug for Symfony?
  • User interface changes

    API changes

Comments

clemens.tolboom’s picture

larowlan’s picture

Does it help to create a comment in the ui and then export it? That format should be what needs to be sent back.

clemens.tolboom’s picture

I rewrote my code to always 'relay' a comment. That made it progress a little

Still degugging through apache errorlog

throw new \RuntimeException($message);

give

Unprocessable Entity: validation failed.

homepage.0.value: This value should be of the correct primitive type.
comment_body: This value should not be null.

Editing the comment through site results into a exection for my testing tool

Guzzle\Http\Exception\ServerErrorResponseException: Server error response
[status code] 500
[reason phrase] Internal Server Error

which is cause by $entity->save()

[Fri Jul 11 13:50:50 2014] [error] [client 127.0.0.1] Uncaught PHP Exception RuntimeException: "exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'a643b978-5caa-4655-8900-afffa4f0a02c' for key 'comment_field__uuid__value''

Removing the UUID from the json fixed it finally.

So how to move on with these DX hickups?

  1. consuming the exception on JSON response
  2. homepage.0.value: why was homepage nagging with "This value should be of the correct primitive type." ... it was missing!
  3. comment_body: This value should not be null. Mitigated by this was done by devel_generate but why didn't devel fail but HAL did?
  4. How to do this for other content?
  5. What to do when field permissions kicks in?
  6. Will patch work?
clemens.tolboom’s picture

Deleting all nodes and comments then trying to POST new data failed on the comment as I did not know it's node yet.

For linking the comment to the new node I had to change an entry in "_embedded". Why? Where is that documented?

"_embedded": {
    "http://drupal.d8/rest/relation/comment/comment/entity_id": [
      {
        "_links": {
          "self": {
            "href": "http://drupal.d8/node/1"
          },
          "type": {
            "href": "http://drupal.d8/rest/type/node/article"
          }
        },
        "uuid": [
          {
            "value": "f437327e-191d-42df-b600-f7ec5208f5b9" <======
          }
        ]
      }
    ],
clemens.tolboom’s picture

vivekvpandya’s picture

POSTING comment on /entity/comment works for me with proper permission and Authorization header.
here is JSON for the same

{
    "_links": {
        "type": {
            "href": "http://tntfoss-vivekvpandya.rhcloud.com/rest/type/comment/node__comment"
        },
        "http://tntfoss-vivekvpandya.rhcloud.com/rest/relation/comment/node__comment/entity_id": [
            {
                "href": "http://tntfoss-vivekvpandya.rhcloud.com/node/16"
            }
        ]
    },
"entity_id":[
{
"target_id":"16",
"revision_id":null
}
],
"subject":[
{
"value":"REST api for Drupal 8 is not completely implemented."
}
],
"comment_body":[
{
"value":"<p>GSoC rocks !.<\/p>\r\n",
"format":"basic_html"
}
]
}
clemens.tolboom’s picture

@vivekvpandya thanks for the update. Did you found some documentation on this? Esp. on node__comment and entity_id.

Do you mind to test #1925618: Ensure Drupal's web services are self-documenting: Swagger support OR rest_api_doc to Drupal core as an experimental module? where ie

currently don't have that information.

vivekvpandya’s picture

@clemens.tolboom
REST and related modules are lacking with documentation badly, What I do is every time first I will try to execute GET on specific REST endpoint with Accept-Type as 'hal+json' then I analyze the response and try to POST on same REST endpoint and try various combinations and eventually I find out minimal "hal+json" for POST different entities.
I will test test your patches on issue #1925618 give me some time I am not regular PHP developer I am working on "example iOS app for Drupal 8".

clemens.tolboom’s picture

@vivekvpandya I document my steps @ https://github.com/build2be/drupal-rest-test :)

kylebrowning’s picture

I get this error when trying to post a comment,

{
    "_links": {
        "type": {
            "href": "http://d8/rest/type/comment/comment"
        },
        "http://d8/rest/relation/comment/comment/entity_id": [
            {
                "href": "http://d8/node/7"
            }
        ]
    },
    "entity_id":[{
      "target_id":"7",
      "revision_id":null
      }],
    "subject":[{
      "value":"comment"
    }],
    "comment_body":[{
      "value":"body",
      "format":"basic_html"
    }]
}

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. in Drupal\Core\Entity\EntityManager->getDefinition() (line 227 of /Users/kylebrowning/Development/PHP/drupal-8/core/lib/Drupal/Core/Entity/EntityManager.php).

dawehner’s picture

Are you sure you used hal+json not only for the getting but also for the posting?

vivekvpandya’s picture

@kylebrowning

Are you trying on localhost ? if yes then your please check for your URLs in your JSON object. : )

kylebrowning’s picture

Yes its localhost.

It still doesn't seem to be working.

kylebrowning’s picture

➜  ~  http -a admin:pass POST http://d8/entity/comment < comment.json 'Content-Type:application/hal+json' 'Accept:application/hal+json' -v
POST /entity/comment HTTP/1.1
Accept: application/hal+json
Accept-Encoding: gzip, deflate
Authorization: Basic YWRtaW46cGFzcw==
Content-Length: 462
Content-Type: application/hal+json
Host: d8
User-Agent: HTTPie/0.8.0

{
    "_links": {
        "http://d8/rest/relation/comment/comment/entity_id": [
            {
                "href": "http://d8/node/7"
            }
        ],
        "type": {
            "href": "http://d8/rest/type/comment/comment"
        }
    },
    "comment_body": [
        {
            "format": "basic_html",
            "value": "body"
        }
    ],
    "entity_id": [
        {
            "revision_id": null,
            "target_id": "7"
        }
    ],
    "subject": [
        {
            "value": "comment"
        }
    ]
}

HTTP/1.1 500 Internal Server Error
Cache-Control: must-revalidate, no-cache, post-check=0, pre-check=0, private
Connection: close
Content-Type: application/json
Content-language: en
Date: Mon, 08 Sep 2014 17:22:55 GMT
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Server: Apache
Transfer-Encoding: chunked
X-Powered-By: PHP/5.4.30
X-UA-Compatible: IE=edge,chrome=1

{
    "error": "Internal Server Error"
}
Berdir’s picture

You need to post the actual error, enable error display or check watchdog.

From looking at this, it is at least missing the correct entity_type and field_name.

kylebrowning’s picture

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "" entity type does not exist. in Drupal\Core\Entity\EntityManager->getDefinition() (line 227 of /Users/kylebrowning/Development/PHP/drupal-8/core/lib/Drupal/Core/Entity/EntityManager.php).

Whats the correct entity type, this information doesn't seem to be document anywhere, At least I haven't found it yet.

Berdir’s picture

The correct entity_type is whatever you want to add the comment to. node, if it's for nodes.

The easiest way to create comments should be to create one in the UI and then GET that through rest.

kylebrowning’s picture

Thank you!

kylebrowning’s picture

Example of working post

{
    "_links": {
        "type": {
            "href": "http://d8/rest/type/comment/comment"
        },
        "http://d8/rest/relation/comment/comment/entity_id": [
            {
                "href": "http://d8/node/7"
            }
        ]
    },
    "entity_type": [{
            "value": "node"
        }],
    "entity_id":[{
      "target_id":"7",
      "revision_id":null
      }],
    "subject":[{
      "value":"comment"
    }],
    "comment_body":[{
      "value":"body",
      "format":"basic_html"
    }]
}
clemens.tolboom’s picture

clemens.tolboom’s picture

droti’s picture

When I post a comment it always shows up as from an "Anonymous User" which is strange because I can post an article and don't have that problem. Does anyone else have this problem?

vivekvpandya’s picture

@droti
I think have faced similar problem. Despite of specifying authentication details it posts comment for "Anonymous User". But I have found the work around at that time ( about a year ago ) I have mentioned User relation in "_links" section it self. However it should not be like this because due to this a user with sufficient privilege can post comments for any other user.
Consider following JSON for it.

{
  "_links":
    {
      "type":"http://tntfoss-vivekpandya.rhcloud.com/rest/type/comment/node__comment"
  },
"http://tntfoss-vivekvpandya.rhcloud.com/rest/relation/comment/node__comment/entity_id":
  [
    {
      "href":"http://tntfoss-vivekvpandya.rhcloud.com/node/16"
    }
  ],
"http://tntfoss-vivekvpandya.rhcloud.com/rest/relation/comment/node__comment/uid":
  [
    {
  }
    "href":"http://tntfoss-vivekvpandya.rhcloud.com/user/7"
    }
  ],
"subject":
  [
    {
    "value":"Some Heading"
    }
  ],
"comment_body":
  [
    {
    "value":"Work hard",
    "format":"basic_html"
    }

  ]
droti’s picture

@vivekvpandya, that didn't work for me but I did get it by specfiying a UID, you can see the ecample below:

  {

  "_links": {
        "type": {
            "href": "http://localhost:8888/rest/type/comment/comment"
        },
        "http://localhost:8888/relation/comment/comment/entity_id": [
            { "href": "http://localhost:8888/rest/type/comment/comment/node/1"}
        ]
    },
    "entity_id": [
      {
        "target_id": "1"
      }
    ],
    "langcode": [
      {
        "value": "en"
      }
    ],
    "subject": [
        {
            "value": "test"
        }],
        
    "uid":[
        {
            
            "target_id": 1
        }
        ],
    "status": [
      {
        "value": "1"
      }
    ],
    "entity_type": [
      {
        "value": "node"
      }
    ],
    "comment_type": [
      {
        "target_id": "vender_review"
      }
    ],
    "field_name": [
      {
        "value": "comment"
      }
    ],
    "comment_body": [
      {
        "value": "Example comment message."
      }
    ]
  }

I'm not really happy with that but it'll do for now.

vivekvpandya’s picture

@droti
As I mentioned in my previous post that I have supplied user id in "_links": section specifically see the code below.

"http://tntfoss-vivekvpandya.rhcloud.com/rest/relation/comment/node__comment/uid":
  [
    {
  }
    "href":"http://tntfoss-vivekvpandya.rhcloud.com/user/7"
    }
  ]

I hope this will work.

vivekvpandya’s picture

@droti
For me following JSON works fine and it also identifies the user who posted the comment

{
  "_links": {
        "type": {
            "href": "http://localhost/dr8b14/rest/type/comment/comment"
        },
        "http://localhost/dr8b14/relation/comment/comment/entity_id": [
            { "href": "http://localhost/dr8b14/rest/type/comment/comment/node/1"}
        ]
    },
    "entity_id": [
      {
        "target_id": "1"
      }
    ],
    "langcode": [
      {
        "value": "en"
      }
    ],
    "subject": [
        {
            "value": "test"
        }],
        
    "uid":[
        {
            
            "target_id": 1
        }
        ],
    "status": [
      {
        "value": "1"
      }
    ],
    "entity_type": [
      {
        "value": "node"
      }
    ],
    "comment_type": [
      {
        "target_id": "comment"
      }
    ],
    "field_name": [
      {
        "value": "comment"
      }
    ],
    "comment_body": [
      {
        "value": "Example comment message."
      }
    ]
  }
Wim Leers’s picture

Assigned: Unassigned » Wim Leers
Category: Bug report » Support request

I'll be working on REST documentation tomorrow.

rashid_786’s picture

I am able to create the comments using above format but unable to create child comment as a reply?

rashid_786’s picture

Ok i have fixed this by adding pid as follows with above format:

"pid": [
{
"target_id": any comment id
}
],

droti’s picture

So I was able to create comments using the above example via postman. However I just integrated this into my webapp and get {"error":"Access denied on creating field 'uid'"}.

Which totally makes sense because you can just post a comment from anyone if you knew what you doing.

It would be really nice if this could pick up the user from the token.

droti’s picture

I hate to be asking question after question, but I'm having problems with caching now. Here is the data I'm posting:

  {

  "_links": {
        "type": {
            "href": "http://localhost:8888/drupal/rest/type/comment/vender_review"
        },
        "http://localhost:8888/drupal/relation/comment/vender_review/entity_id": [
            { "href": "http://localhost:8888/drupal/rest/type/comment/vender_review/node/3"}
        ]
    },
    "entity_id": [
      {
        "target_id": "3"
      }
    ],
    "langcode": [
      {
        "value": "en"
      }
    ],
    "subject": [
        {
            "value": "test test"
        }],
        
    "entity_type": [
      {
        "value": "node"
      }
    ],
    "comment_type": [
      {
        "target_id": "vender_review"
      }
    ],
    "field_name": [
      {
        "value": "field_reviews"
      }
    ],
      "field_capabilities_rating": [
    {
      "value": "1"
    }
  ],
    "comment_body": [
      {
        "value": "Example comment message."
      }
    ]
  }

But I get a 500 error and the error looks like this:

[04-Mar-2016 22:30:15 America/Chicago] Uncaught PHP Exception LogicException: "The controller result claims to be providing relevant cache metadata, but leaked metadata was detected. Please ensure you are not rendering content too early. Returned object class: Drupal\rest\ResourceResponse." at /Users/Domenic/Documents/vendscore/vendscore-drupal/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php line 159
 

If I comment that out, then I'm good but I'm not sure how prevent this caching from happening...

droti’s picture

Thank so much! I tried searching but I was not looking in the right spots! That patch did the trick for me.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

kier.heyl’s picture

I just wanted to second @droti and @vivekvpandya.

Currently when you post a comment using basic_auth you create an anonymous comment.

If you're authorizing with an user who has privileges to administrate comments you can pass in a uid, but this is not and should not be available to basic authenticated users.

Desired fix would be that it assigns the created comment to the authenticated user in the same way a created node is done.

Does this need to be a separate ticket?

clemens.tolboom’s picture

@kier.heyl Is there a difference when creating a session based comment?

kier.heyl’s picture

@clemens.tolboom

I tried it with basic auth, and cookie auth. In both cases despite requiring authentication to post a comment, neither one actually associates the comment with the authenticated user.

Wim Leers’s picture

Title: How to POST a comment and other relational entities » How to POST a comment and other entities using entity references

Clarifying title, and marked #2676206: How to POST an "entity reference" field to a node ? as a duplicate of this one.

jacov’s picture

I updated documentation on POST & PATCH pages using examples with 'article' taxonomy entity reference field;

see full documentation here:
https://www.drupal.org/documentation/modules/rest/post
https://www.drupal.org/documentation/modules/rest/patch

and snippet POST ent_ref code example here:

curl --request POST -k -i -s --user user:password --header 'Content-type: application/hal+json' -H 'Cache-Control: no-cache' --header 'X-CSRF-Token: tokenhash' 'https://wabee.org/entity/node?_format=hal_json' --data-binary '
{
  "_links": {
    "type": {
      "href": "https://wabee.org/rest/type/node/article"
    },
    "https://wabee.org/rest/relation/node/article/field_tags": {
       "href": "https://wabee.org/taxonomy/term/1?_format=hal_json"
    }
  },
  "type": {
      "target_id": "article"
    },
  "title": {
      "value": "2016-07-20 My Article"
    },
  "body": {
      "value": "some body content aaa bbb ccc"
  },
    "_embedded": {
      "https://wabee.org/rest/relation/node/article/field_tags": [
        {
          "_links": {
            "self": {
              "href": "https://wabee.org/taxonomy/term/1?_format=hal_json"
            },
            "type": {
              "href": "https://wabee.org/rest/type/taxonomy_term/tags"
            }
          },
          "uuid": [
            {
              "value": "ff61ea71-2540-47fe-a4bb-384b12d4de47"
            }
          ],
          "lang": "en"
        }
      ]
    }
}'
clemens.tolboom’s picture

@jacov thanks for the update.

Can you use the long options for your curl commands: -k -i -s is a little alien for curl savvies.

Any idea why we only document POST/PATCH using _format=hal_json and not plain _format=json?

jacov’s picture

@clemens.tolboom afaik hal_json format allows many to many nesting, required for joining entities via _link / _embed

Wim Leers’s picture

Status: Active » Fixed
Issue tags: -Needs Documentation

Thanks, @jacov. I cleaned up your language/explanations/example: https://www.drupal.org/node/2098511/revisions/view/9909399/9910159.

And because @jacov provided a concrete example, that meant I just had to do touch-ups, so now effectively this missing documentation has been written. So we can finally close this issue :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

pranil_kochar’s picture

Does anybody know how to create a user in drupal using rest apis??...

im using post man and my url is "http://localhost/entity/user"
i m not able to form a request body for this ...

pranil_kochar’s picture

@vivekvpandya can u please tell me how to make PATCH request for comments in drupal.
for the PATCH request do we need to change the request body, we formed while creating the comment?

pranil_kochar’s picture

@vivekvpandya,

my url: http://localhost/comment/7 (PATCH)

Content-Type:application/hal+json
Accept:application/hal+json
Authorization:Basic cHJhbmlsOnJvb3Q=

and REQUEST body:

{
"_links": {
"type": {
"href": "http://localhost/rest/type/comment/comment"
},
"http://localhost/relation/comment/comment/entity_id": [
{ "href": "http://localhost/rest/type/comment/comment/node/10"}
]
},
"entity_id": [
{
"target_id": "10"
}
],
"langcode": [
{
"value": "en"
}
],
"subject": [
{
"value": "aaaaaaaaaaaaaaa......"
}],

"uid":[
{

"target_id": 1
}
],
"status": [
{
"value": "1"
}
],
"entity_type": [
{
"value": "node"
}
],
"comment_type": [
{
"target_id": "comment"
}
],
"field_name": [
{
"value": "comment"
}
],
"comment_body": [
{
"value": "................."
}
]
}

ERROR i m GETTING:

{
"error": "Access denied on updating field 'entity_id'."
}

All my permissions are checked...

vivekvpandya’s picture

Hi, @pranil_kochar

For patch request it is not necessary to submit all details that you used while creation but what is necessary is required to be decide by looking at code or by trail and error.
If you read the error message carefully than you will find that your request is trying to change entity_id which is something not allowed in any database based system (i.e primary key) so you need to find out what things are required to be specified for update operation.
My hunch is that with PATCH request URL you are already specifying entity id than remove entity_id from the request body.
Just to give analogous example consider PATCH request body for update the user details

 {"name":[{"value":"somevalue"}],
  "mail":[{"value":"abc@example.com"}],
  "pass":[{"existing":"existingSecretPass", "value": "myNewSuperSecretPass"}]
 }

Here User id is specified with in the URL of patch request.
Let me know if this help.

Vivek

pranil_kochar’s picture

Hi, @vivekvpandya
thanks for u r suggestion
now its working fine with the request body:

{
"langcode":[{"value":"en"}],
"subject":[{"value":"UPDATED Subject"}],
"uid":[{"target_id":"1","url":"/localhost/user/1"}],
"status":[{"value":"1"}],
"comment_type":[{"target_id":"comment"}],
"default_langcode":[{"value":"1"}],
"comment_body":[{"value":"updated11"}]
}

pranil_kochar’s picture

@vivekvpandya,

Why some time we use request body in "_link" format and sometime in simple JSON format??
like to create a comment we have used "_link" format but to update the comment we have used simple JSON format? is thr any specify reason?

and have you created a "user" using REST apis? if yes then could you please share your request body if possible?

vivekvpandya’s picture

@pranil_kochar you are welcomed.

"_link" are used to specify relationship among entities and it is usually used by the REST client to figure out various related REST end points. This is also known as HATEOS in terms of REST architecture and for Drupal it is implemented as HAL module so for this type of request/response we need to pass a header value of Content-type = "application/hal+json"

Please read more about REST standards you will get to know more about it. So yes we only use hal+json when it makes sense.

Yes I have created "user" resource with REST API but I don't have a full JSON with me but I am providing you Objective-C code which builds JSON for my application.
It is very simple and that should be enough to help you out.

// NSDictionary is simple storage with key : value pair by removing "@" you can get equivalent JSON.
 NSDictionary *params = @{
                                @"langcode": @[
                                        @{
                                            @"value": @"en"}
                                        ],
                                @"name": @[
                                        @{
                                            @"value": "userName"
                                            }
                                        ],
                                @"mail": @[
                                        @{
                                            @"value": "email"
                                            }
                                        ],
                                @"pass": @[
                                        @{
                                            @"value": "password"
                                            }
                                        ]
                                };

NSMutableDictionary *dict = [NSMutableDictionary new];

// There are few more things that requires to be added to JSON body defined above.
// The string build below is value for "_links" in hal+json
 
    NSString *href = [NSString stringWithFormat:@"%@/rest/type/%@/%@", [[[DIOSSession sharedSession] baseURL] absoluteString], name, type];

    // here name = "user" and type = "user"

    NSDictionary *defaultDict = @{@"_links" : @{@"type" : @{@"href" : href}}};

// merge very thing
    [dict addEntriesFromDictionary:defaultDict];

    [dict addEntriesFromDictionary:params];

    // This code change is due to https://www.drupal.org/node/2291055
// path is little different than normal entity 

    NSString *path  = nil;
    
    path = [NSString stringWithFormat:@"entity/%@/register", name];


  //  then make a POST request with path and dict as your request body.

I hope this will help.
Please let me know if you don't understand any thing.

pranil_kochar’s picture

@vivekvpandya,

thanx man ... u really helped me a lot..

In all thr are 3 objects only right? in drupal(comments,node,user)?

vivekvpandya’s picture

@pranil_kochar welcome any time!

These 3 are basic concepts but Drupal is very powerful and it has other configuration entities too and REST also exposes services for them and Drupal has plans to make this support very robust.

pranilkochar’s picture

@vivekvpandya

thanx a lot.

DRUPAL 8 supports Oauth 2.0 as an authentication mechanism?
if yes, then what all modules we have to include?

prabhakarb’s picture

Here is the Solution. Working fine.

POST : http://YOURSITE.com/entity/comment?_format=hal_json
Headers:
Accept : application/json
Content-Type : application/hal+json
X-CSRF-Token : get by hitting http://YOURSITE.com/rest/session/token

Optional headers:
Authorization : Basic YZBWdYNJcjpwYXNzQDEyMw==

JSON formatted data to send to Drupal

{
    "_links": {
        "type": {
            "href": "http://YOURSITE.com/rest/type/comment/comment"
        },
        "http://YOURSITE.com/rest/relation/comment/comment/entity_id": [
            {
                "href": "http://YOURSITE.com/node/<NodeID>"
            }
        ]
    },
    "entity_id":[{"target_id":<NodeID>}],
    "entity_type":[{"value":"node"}],
    "comment_type":[{"target_id":"comment"}],
    "field_name":[{"value":"<Field name given in the content type>"}],
    "subject":[{"value":"Goodbye World"}],
    "name":[{"value":"<user name>"}],
    "comment_body":[
      {"value":"comment which you want write"}
  ]  
}
hubobbb’s picture

hi ,prabhakarb . I use RESTful but ,I get 403 forbidden with Drupal8.3.2 .

if I donot set "name":[{"value":""}], and post sucessful ,but comment's UID is 0.

so I use the services module to do this ,but get the same 403 forbidden .

at last ,I close services 8.4.0
CSRFTokenAccessCheck.php
... if(!\Drupal::csrfToken()->validate($csrf_token, 'services'))..
temp to go on dev .

can anyone help this .

Thankyou .

hubobbb’s picture

and i work well like this .
remove :
"entity_id":[{"target_id":}],
"entity_type":[{"value":"node"}],
,rest cannot let you edit entity field .