Can’t retrieve body params from PUT endpoint using formdata

This is because PUT requests don’t have body parameters, that’s not how PUT works. PUT doesn’t quite do what you thought it did, and can only be used to upload a file from a client.

Your endpoint is incompatible with PUT as a request type because you’re providing parameters as key value pairs, and that is not possible with PUT:

According to the HTML standard, you can not. The only valid values for the method attribute are get and post, corresponding to the GET and POST HTTP methods. is invalid HTML and will be treated like , i.e. send a GET request.

Likewise:

XHTML 1.x forms only support GET and POST. GET and POST are the only allowed values for the “method” attribute.


As for WordPress, it doesn’t handle PUT and treats it as an alias of POST along with PATCH, so while its handling is technically correct, it’s only by accident.

Now this doesn’t prevent PHP from using it as a file upload mechanism, but that is the only thing it can be used for:

https://www.php.net/manual/en/features.file-upload.put-method.php

tech