# Self vs. related links (and what to return)

**URL:** <https://discuss.jsonapi.org/t/self-vs-related-links-and-what-to-return/1236>\
**Category:** Uncategorized\
**Created:** [March 14, 2018, 3:17pm UTC](https://discuss.jsonapi.org/t/self-vs-related-links-and-what-to-return/1236 "2018-03-14T15:17:16Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![maartenzwart](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/maartenzwart/32/534_2.png) [@maartenzwart](https://discuss.jsonapi.org/u/maartenzwart)\
**Post date:** [March 21, 2018, 2:56pm UTC](https://discuss.jsonapi.org/t/self-vs-related-links-and-what-to-return/1236/9 "2018-03-21T14:56:35Z")

</div>

If I may, after doing some research on the subject myself, I came across this explanation of @dgeb in a (rather old) [post](https://github.com/json-api/json-api/issues/1064) on github:

> A self link for a relationship is called the “relationship URL” and should return the relationship’s linkage data - i.e. the resource identifier object(s) associated with the relationship. Requests can also be sent to the relationship URL to modify the relationship.
> 
> A related link for a relationship is called the “related resource URL” and should return the resource(s) currently in the relationship.
> 
> Given that, you should use related in your links (e.g. “[https://api.example.com/compliance/facilities](https://api.example.com/compliance/facilities)”) to return full resource objects.

The way I interpret this, together with the specs, I would come to the following request/responses based on your example:

The `self` link `http://example.com/articles/1/relationships/author` will return:

```
{
  "data": { 
      "type": "people",
      "id": "9"
  }
}

```

Whilst the `related` link in that case should be `http://example.com/articles/1/author`, which would return the entire resource object:

```
{
  "data": { 
    "type": "people",
    "id": "9",
    "attributes": { .. },
    "links": { 
      "self": "http://example.com/people/9"
    }
  }
}

```

Does that make sense?

---

_[View the full topic](https://discuss.jsonapi.org/t/self-vs-related-links-and-what-to-return/1236)._
