"No route found for the specified format html." when logged in

Created on 26 April 2022, almost 3 years ago
Updated 21 March 2024, 11 months ago

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.

πŸ› Bug report
Status

Active

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States RichardDavies Portland, Oregon

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024