Language negotiation doesn't respect langcode filter

Created on 23 May 2019, over 5 years ago
Updated 11 February 2025, 11 days ago

Problem/Motivation

JSON:API behaves oddly when retrieving translations or trying to filter by langcode

In this example:

This bug was found by @alwaysworking who may have some additional information to add.

UPDATE: The above behaviour was on Drupal 8.6 & 2.1 of JSON API (See #5 🐛 Language negotiation doesn't respect langcode filter Active )

Currently on Drupal 9.1.x:

  • http://[site_url]/jsonapi/node/[content_type]:
    Returns only nodes in the default language
  • http://[site_url]/jsonapi/node/[content_type]?filter[langcode]=[langcode]:
    Returns only nodes in the default language for which there is an available translated node in language [langcode]
  • http://[site_url]/[langcode]/jsonapi/node/[content_type]:
    Returns nodes in language [langcode] if there's an available translated node in language [langcode], and nodes in the default language for which there is no available translated node in language [langcode]
  • http://[site_url]/[langcode]/jsonapi/node/[content_type]?filter[langcode]=[langcode]:
    Returns only nodes for which there is an available translated node in language [langcode]
🐛 Bug report
Status

Active

Version

11.0 🔥

Component

jsonapi.module

Created by

🇬🇧United Kingdom justafish London, UK

Live updates comments and jobs are added and updated live.
  • D8MI

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

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.

  • 🇧🇪Belgium borisson_ Mechelen, 🇧🇪

    We are running into this issue as well. If I were to get some time to work on this, where would I start?

Production build 0.71.5 2024