# Is it acceptable to only include relationship data on certain endpoints?

**URL:** <https://discuss.jsonapi.org/t/is-it-acceptable-to-only-include-relationship-data-on-certain-endpoints/1851>\
**Category:** Uncategorized\
**Created:** [February 27, 2020, 12:39pm UTC](https://discuss.jsonapi.org/t/is-it-acceptable-to-only-include-relationship-data-on-certain-endpoints/1851 "2020-02-27T12:39:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![garbetjie](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/garbetjie/32/671_2.png) [@garbetjie](https://discuss.jsonapi.org/u/garbetjie)\
**Post date:** [February 27, 2020, 12:39pm UTC](https://discuss.jsonapi.org/t/is-it-acceptable-to-only-include-relationship-data-on-certain-endpoints/1851/1 "2020-02-27T12:39:30Z")

</div>

Hi there.

I hope the topic is self-explanatory.

Basically, in my API I have two resource types: `albums` and `tracks`.

There are two endpoints, one for paginating all albums in the system (`/albums`), and one for fetching a single album (`/albums/$ALBUM_ID`).

This is an example response for paginating albums:

```auto
{
  "data": [
    "type": "albums",
    "id": "1",
    "attributes": {
      "name": "Album 1"
    },
    "relationships": {
      "tracks": {
        "links": {
          "related": "/albums/1/tracks"
        }
      }
    }
  ]
}

```

And this is an example response for viewing a specific album:

```auto
{
  "data": {
    "type": "albums",
    "id": "1",
    "attributes": {
      "name": "Album 1"
    },
    "relationships": {
      "tracks": {
        "data": [
          {"type": "tracks", "id": 1},
          {"type": "tracks", "id": 2},
          {"type": "tracks", "id": 3}
        ],
        "links": {
          "related": "/albums/1/tracks"
        }
      }
    }
}

```

Is this considered valid according to the spec? Specifically with regards to only including the actual relationship data when viewing a single album. When paginating albums, the relationship data is not included.

---

<div class="post-metadata">

**Author:** ![prathe](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/prathe/32/643_2.png) [@prathe](https://discuss.jsonapi.org/u/prathe)\
**Post date:** [September 9, 2020, 8:10pm UTC](https://discuss.jsonapi.org/t/is-it-acceptable-to-only-include-relationship-data-on-certain-endpoints/1851/2 "2020-09-09T20:10:51Z")

</div>

I think it is valid not to provide the data in a relationships unless a related resource would appear in a compound document, whatever you decide to include the “tracks” by default or the client request its inclusion.

> Compound documents require “full linkage”, meaning that every included resource **MUST** be identified by at least one resource identifier in the same document.
