The error message indicates that the reason of the error is the JSON being sent doesn't have the $id
property. And indeed, the JSON doesn't have $id
in the main object.
So your code that tries to set the $id
is not working well, and that's exactly the part I mentioned is wrong (the Edit/Post construction).