Problem/Motivation

GET /api/node/article/900b681b-581a-4624-9ff6-99cc865df429/relationships/field_tags?_format=api_json&include=vid HTTP/1.1
Host: d8dev.local
Cache-Control: no-cache

Generates:

{
    "data": [
        {
            "type": "taxonomy_term--tags",
            "id": "3a04bb9e-8277-4615-8590-dd8c2ef8ad19"
        },
        {
            "type": "taxonomy_term--tags",
            "id": "e6520c95-45f0-45b7-8b69-d55a03fca109"
        }
    ],
    "links": {
        "self": "http://d8dev.local/api/node/article/900b681b-581a-4624-9ff6-99cc865df429/relationships/field_tags?_format=api_json",
        "related": "http://d8dev.local/api/node/article/900b681b-581a-4624-9ff6-99cc865df429/field_tags?_format=api_json"
    }
}

Without the includes. That is an error according to the spec: http://jsonapi.org/format/#fetching-includes

Proposed resolution

Fix it.

Comments

e0ipso created an issue. See original summary.

e0ipso’s picture

Priority: Normal » Critical
e0ipso’s picture

Status: Active » Needs review
StatusFileSize
new3.5 KB

  • e0ipso committed 1665df8 on 8.x-1.x
    Issue #2801885 by e0ipso: [BUGFIX] The relationships endpoint is not...
e0ipso’s picture

Status: Needs review » Fixed

Merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

wim leers’s picture

The IS says that this:

{
    "data": [
        {
            "type": "taxonomy_term--tags",
            "id": "3a04bb9e-8277-4615-8590-dd8c2ef8ad19"
        },
        {
            "type": "taxonomy_term--tags",
            "id": "e6520c95-45f0-45b7-8b69-d55a03fca109"
        }
    ],
    "links": {
        "self": "http://d8dev.local/api/node/article/900b681b-581a-4624-9ff6-99cc865df429/relationships/field_tags?_format=api_json",
        "related": "http://d8dev.local/api/node/article/900b681b-581a-4624-9ff6-99cc865df429/field_tags?_format=api_json"
    }
}

is what JSON API returned before this fix went in. Well, today, in HEAD, that's also what JSON API returns when requesting http://d8dev.local/jsonapi/node/article/c32bef09-21f5-4b63-a51f-29d0734edc3c/relationships/field_tags?include=vid. No vid to be seen.

So it looks like HEAD regressed wrt this issue, which is understandable, given that there's no test coverage for this.