Custom Endpoint - Does it possible to use PUT method with WP API Rest?

If I use the PUT method inside register_rest_route like this :

add_action('rest_api_init', function () {
  register_rest_route( 'mydomain/v1', 'item/(?Pid\d+)',array(
                'methods'  = 'PUT',
                'callback' = 'update_item'
      ));
});

How can I get the parameters inside the callback

With the POST I get these params with :

function update_item($request)
{

    $params = $request-get_params();
    ....


But This doesn't work with the PUT method.

Thanks for your advices.

Topic endpoints rest-api api plugin-development customization Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.