Allow REST resource config entities to specify a default format

Created on 14 February 2017, almost 8 years ago
Updated 31 August 2024, 3 months ago

Currently, in order to use JSON format on GET request, REST API requires ?_format=json.

I suggest introducing a default_format per resource to be used when no ?_format=json is provided.

Proposed format for config/install yaml:

id: demo
langcode: de
status: true
plugin_id: demo
granularity: resource
configuration:
  methods:
    - GET
  default_format: json
  formats:
    - json
  authentication:
    - cookie
dependencies:
  module:
    - serialization
Feature request
Status

Active

Version

11.0 🔥

Component
REST 

Last updated 7 days ago

Created by

🇦🇹Austria maosmurf

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs change record

    A change record needs to be drafted before an issue is committed. Note: Change records used to be called change notifications.

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.

  • 🇨🇦Canada minoroffense Ottawa, Canada

    Here's a patch that uses the accept headers as decriebed in #25

    Could be worked into the main issue of having a default format or on its own to leverage http headers to set the request format instead of that argument.

Production build 0.71.5 2024