Has anyone got a recent example of a REST client under Drupal 9, possibly using AJAX?
You may need to add below line in .htaccess or nginx config to allow php file be executed
RewriteCond %{REQUEST_URI} !/libraries/civicrm/extern/[a-z]+\.php$

Copy extern directory from civicrm vendor folder into libraries
The rest api url for drupal would look like
https://sitename/libraries/civicrm/core/extern/rest.php