How to access the request in REST API
The only classes that extend ResourceBase implemented by Drupal core don't check/use what passed in the request. So I could not use Drupal core code as example.

If you really need to access any request value, and the argument passed to the get() or post() methods is not enough/adequate for your purpose, you can inject the request object in the create() static method.

  public function __construct(array $configuration, $plugin_id, $plugin_definition, array $serializer_formats, LoggerInterface $logger, Request $request) {
    parent:: __construct($configuration, $plugin_id, $plugin_definition,  $serializer_formats, $logger);
    $this-&gt;request = $request;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static(
      $configuration, 
      $plugin_id, 
      $plugin_definition, 
      $container-&gt;getParameter('serializer.formats'), 
      $container-&gt;get('logger.factory')-&gt;get('rest'),
      $container-&gt;get('request_stack')-&gt;getCurrentRequest()
    );
  }


In the class methods you then use $this-&gt;request to access the request object.