How do I change the created date when I create a node? When i do POST request for create node i get error:

{
  "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1",
  "title": "Property created cannot be set.",
  "status": 400,
  "detail": "Bad Request",
  "instance": ""
}


My restful resource provide this field:

protected function publicFields() {
  $public_fields = parent::publicFields();

  // Another fields ...

  $public_fields['created'] = [
    'property' =&gt; 'created',
  ];
}


I use restful module.
I solved this problem via hook_node_presave();

function hook_node_presave($node) {
  $node-&gt;created = "you_timestamp";
}