I had a REST resource for a custom entity working in 8.3, but when I try hitting it in 8.5, I get a 406 with message": "Not acceptable format: json" in the body.

Here's my config, with json clearly defined as the format:

langcode: en status: true dependencies: module: - basic_auth - MY_MODULE - serialization id: entity.MY_ENTITY plugin_id: 'entity:MY_ENTITY' granularity: resource configuration: methods: - GET formats: - json authentication: - basic_auth

I've tried stepping through code with Xdebug in PHPStorm, but not having much luck seeing where this is coming from.

1 Answer 1


You have to add this on the end of your endpoint URL:

?_format=FORMAT. So if you want JSON, its ?_format=json.

This is a new change in 8.5.0 requiring this argument, but I could not locate in the changelogs exactly why it is now required otherwise a 406 is returned.

This same thing happened to all my REST endpoints until I added that.

  • This is the issue for the regression, drupal.org/project/drupal/issues/2937942, which has a few more related ones.
    – mpdonadio
    Mar 29, 2018 at 20:18
  • I've got that _format parameter in there (without it, the error says html is not an accepted format). It worked fine in 8.3. 8.5 is the first time I've ever seen that error about json being unacceptable. I'm also not using views, this is in the Drupal core entity REST resource. Apr 3, 2018 at 11:15
  • I should also add that I have a custom REST resource that works fine in both 8.3 and 8.5 (with ?_format=json required for both). Apr 3, 2018 at 12:04
  • Yes, mark format json from settings - joxi.ru/n2YjVE4iZo9qLA Feb 4, 2020 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.