Hello,

I created a RestResource plugin that exposes some data in JSON format. The problem I'm having is that when I access the defined URL for that plugin, I also have to specify the "_format=json" parameter.

Is there a way to alter the default '_format' so that it's json, instead of html, so I can ommit passing it in the URL?

Issue fork drupal-2821701

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vdanielpop created an issue. See original summary.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dawehner’s picture

Wim Leers’s picture

Category: Support request » Task
Issue tags: -route rest resource format parameter

Thanks for pointing to this issue, @dawehner!

Wim Leers’s picture

Component: routing system » rest.module
Status: Active » Closed (duplicate)
Related issues: +#2852587: Allow REST resource config entities to specify a default format

This was filed against the routing system component and was hence not discovered until now. Somebody just created #2852587: Allow REST resource config entities to specify a default format and included a patch. So closing this in favor of that.

paul121 made their first commit to this issue’s fork.