title: Wordpress Rest Api Update content with POST on custom endpoint
body: <p>I'm creating a custom endpoint for Post Type Post.
  The request from Javascript work fine, but  can't understand how update, for example, the content of a post.</p>
  
  <p>I've created and registered a route, i've created a callback function for a route and i've created a little form where i insert the post ID and the content.</p>
  
  <p>This is the Code For Route</p>
  
  <pre><code>add_action('rest_api_init', function() {
      register_rest_route('wl/v1', 'postsAdd/(?P&lt;id&gt;\d+)', [
          'methods' =&gt; 'POST',
          'callback' =&gt;'wl_post_write',
      ]);
  })
  </code></pre>
  
  <p>This is the callback function</p>
  
  <pre><code>function wl_post_write( $request ) {
      $parameters = $request-&gt;get_params();
      return $parameters;
  }
  </code></pre>
  
  <p>The XMLHTTPRrequest from javascript is</p>
  
  <pre><code>    var ourPostData = {
          "content": content
      }
  
      var updatePost = new XMLHttpRequest(); 
  
      updatePost.open("Post", mySiteData.siteURL + '/wp-json/wl/v1/postsAdd/'+id+'/?post_type=post');
  
      updatePost.setRequestHeader("X-WP-Nonce", mySiteData.nonce);
  
      updatePost.setRequestHeader("Content-Type","application/json;charset=UTF-8");
  
      updatePost.send( JSON.stringify(ourPostData) );
  
      console.log(updatePost.responseText);
  </code></pre>
  
  <p>Variables "content" and "id" is the value i write inside the form field.</p>
  
  <p>The console.log of responseText is:</p>
  
  <pre><code>    {"id":"51","post_type":"post","content":"my new post content"}
  </code></pre>
  
  <p>The code Above return the correct parameters i sent with the request, but this not update the content inside the post with id 51.</p>
  
  <p>I can't understand how update it.</p>
  
  <p>Thanks alot</p>