In the jsonapi module all references to entities are done by UUID's. This is consistent but this means in the previous release it was impossible to filter by its (more readable) target_id
.
This change exposed the target_id
in the meta information for a Resource. Making it more readable, easier to code against and filterable.
Example where node_type is now actually readable.
{
"jsonapi": {...},
"data": [
{
"type": "node--article",
"id": "0fe30767-31c6-4c97-9a19-83402eda782e",
"links": {...},
"attributes": {...},
"relationships": {
"node_type": {
"data": {
"type": "node_type--node_type",
"id": "0c2b2d5b-83b1-4235-b5b8-9b43a168230b",
"meta": {
"drupal_internal__target_id": "article"
}
}
},
"field_tags": {
"data": [
{
"type": "taxonomy_term--tags",
"id": "e9436484-81cf-481a-8e03-64450e6bd20c",
"meta": {
"drupal_internal__target_id": 2
}
},
{
"type": "taxonomy_term--tags",
"id": "86de8f96-ee71-4ca1-9ac1-e4be5a7ade0f",
"meta": {
"drupal_internal__target_id": 4
}
},
{
"type": "taxonomy_term--tags",
"id": "a22aa858-f8b6-463c-8e64-2867e8da6b51",
"meta": {
"drupal_internal__target_id": 6
}
}
],
"links": {...}
},
"links": {...}
}
}
],
"links": {...}
}
This also makes is possible to filter on target_id
instead of UUID's.
Filter before:
/jsonapi/node/article?filter[field_tags.id]=e9436484-81cf-481a-8e03-64450e6bd20c
Now allowed:
/jsonapi/node/article?filter[field_tags.meta.drupal_internal__target_id]=2