Problem/Motivation

Accessing a REST URL returns the following error when multiple serialization formats are allowed and the user is logged in:

No route found for the specified format html. Supported formats: csv, hal_json, schema_json:json, json, xml.

The recent log messages report this error:

Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException: No route found for the specified format html. Supported formats: json, xml. in Drupal\Core\Routing\RequestFormatRouteFilter->filter() (line 65 of /app/web/core/lib/Drupal/Core/Routing/RequestFormatRouteFilter.php).

Steps to reproduce

  1. Create a view and add a REST export
  2. Make sure that multiple request formats are checked on the serializer settings (e.g. json and xml)
  3. Set a path for your export (e.g. /api/export) and set access to 'unrestricted'
  4. Save the view
  5. While logged in, access the REST URL (e.g. /api/export?_format=json) and note the resulting error described above
  6. Log out of Drupal and access the URL, which should work now and return requested data in JSON format.
  7. Log back in and change serializer to only allow one request format (e.g. json) and access the URL one more time while logged in and note that it works this time

Proposed resolution

You should be able to access an unrestricted REST URL that supports multiple request formats regardless of whether you're currently logged in or not. I'm pretty sure this used to work correctly, but I'm currently experiencing this problem on a site running Drupal 9.3.12 and views_data_export 1.1.

Comments

RichardDavies created an issue. See original summary.

brad.bulger’s picture

May be related to this other long standing issue.