Change record status: 
Project: 
Introduced in branch: 
8.x-2.x
Introduced in version: 
8.x-2.0
Description: 

The JSON API spec says:

Fields
A resource object's attributes and its relationships are collectively called its "fields".

Fields for a resource object MUST share a common namespace with each other and with type and id. In other words, a resource can not have an attribute and relationship with the same name, nor can it have an attribute or relationship named `type` or `id`.

— http://jsonapi.org/format/#document-resource-object-fields


We now apply this consistently in the Drupal JSON API module too:

  • attributes.uuid is now absent from the normalization
  • attributes.<id> is now automatically aliased to attributes.drupal_internal__<id> to signal to users that it's only useful in use cases that have tight Drupal coupling. This also means that non-Drupalists looking at Drupal's JSON API normalizations won't be confused anymore by its exposing of multiple identifiers (UUIDs in JSON API's mandatory id field)

A few entity types have a type field that is not a bundle field. These are now automatically aliased to <ENTITY TYPE ID>_type.

Thanks to this, Fields for a resource object MUST share a common namespace with each other and with type and id. is now a reality for Drupal's JSON API implementation. This simplifies JSON API clients' implementations.

Example

When GETting node--article resources (Node entities of the article bundle), you'll need the following changes:

  1. attributes.uuid: use id instead
  2. attributes.nid: is now automatically aliased to attributes.drupal_internal__nid. However, you shouldn't need the serial (local) IDs except when e.g. building a Drupal admin UI!
  3. relationships.type is now automatically aliased to relations.node_type
Impacts: 
Site builders, administrators, editors
Module developers
Themers