# Confusion on relationships in author example

**URL:** <https://discuss.jsonapi.org/t/confusion-on-relationships-in-author-example/2695>\
**Category:** Uncategorized\
**Created:** [September 5, 2023, 11:24pm UTC](https://discuss.jsonapi.org/t/confusion-on-relationships-in-author-example/2695 "2023-09-05T23:24:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![td4242](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/td4242/32/825_2.png) [@td4242](https://discuss.jsonapi.org/u/td4242)\
**Post date:** [September 5, 2023, 11:24pm UTC](https://discuss.jsonapi.org/t/confusion-on-relationships-in-author-example/2695/1 "2023-09-05T23:24:27Z")

</div>

```auto
{
  "type": "articles",
  "id": "1",
  "attributes": {
    "title": "Rails is Omakase"
  },
  "relationships": {
    "author": {
      "links": {
        "self": "/articles/1/relationships/author",
        "related": "/articles/1/author"
      },
      "data": { "type": "people", "id": "9" }
    }
  }
}

```

Looking at this example I see that there is a “people” resource with id “9” and that that “people” is the author of this comment. I don’t see any hints on where I need to go to look up people/9 in the links. I’m also curious if this article had multiple authors, like say people/9 plus chatGPT and I had it listed out as:

```auto
{
  "type": "articles",
  "id": "1",
  "attributes": {
    "title": "Rails is Omakase"
  },
  "relationships": {
    "authors": {
      "links": {
        "self": "/articles/1/relationships/author",
        "related": "/articles/1/author"
      },
      "data": [
        { "type": "people", "id": "9" },
        { "type": "ai", "id": "2" }
    }
  }
}

```

How might I provide links to both my people/9 resource and ai/2 resource?

---

<div class="post-metadata">

**Author:** ![td4242](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/td4242/32/825_2.png) [@td4242](https://discuss.jsonapi.org/u/td4242)\
**Post date:** [September 5, 2023, 11:26pm UTC](https://discuss.jsonapi.org/t/confusion-on-relationships-in-author-example/2695/2 "2023-09-05T23:26:09Z")

</div>

My first thought was that there should be a people and ai links type

````auto
{
  "type": "articles",
  "id": "1",
  "attributes": {
    "title": "Rails is Omakase"
  },
  "relationships": {
    "authors": {
      "links": {
        "self": "/articles/1/relationships/author",
        "related": "/articles/1/author",
        "people": "/people",
        "ai": "/ai"
      },
      "data": [
        { "type": "people", "id": "9" },
        { "type": "ai", "id": "2" }
    }
  }
}```
````

---

<div class="post-metadata">

**Author:** ![jelhan](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/jelhan/32/822_2.png) [@jelhan](https://discuss.jsonapi.org/u/jelhan)\
**Post date:** [September 11, 2023, 7:24pm UTC](https://discuss.jsonapi.org/t/confusion-on-relationships-in-author-example/2695/3 "2023-09-11T19:24:13Z")

</div>

If you want to fetch the related resources, you can do a `GET` request to the `related` link of the relationship. Using that URL has the benefit that it returns the current state. That means it could also be used to reload related authors in case it may have changed.

The resource identifiers provided under `data` member are primarily meant to link resources within a document. That’s why it’s also called _resource linkage_.

Additionally a client may use them to

- identify if it’s a has-one or has-many relationship,
- if a resource is attached to it and in case of has-many how many resources are attached to it, and
- mapping it to existing resource data in local cache.

Resource identifier objects are not meant to fetch the resources.

---

<div class="post-metadata">

**Author:** ![td4242](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/td4242/32/825_2.png) [@td4242](https://discuss.jsonapi.org/u/td4242)\
**Post date:** [September 11, 2023, 9:23pm UTC](https://discuss.jsonapi.org/t/confusion-on-relationships-in-author-example/2695/4 "2023-09-11T21:23:30Z")

</div>

So in the above example, author should be plural since it is transitioning to a to-many, and a `GET` to `/articles/1/authors` should return both the `/people/9` and `/ai/2` resources within the top level data response?

---

<div class="post-metadata">

**Author:** ![jelhan](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.jsonapi.org/jelhan/32/822_2.png) [@jelhan](https://discuss.jsonapi.org/u/jelhan)\
**Post date:** [September 27, 2023, 5:29am UTC](https://discuss.jsonapi.org/t/confusion-on-relationships-in-author-example/2695/5 "2023-09-27T05:29:39Z")

</div>

If an article should have multiple authors and if an author could be either a person or an artificial intelligence in your domain: yes.

---

<div class="post-metadata">

**Author:** ![Danni666](https://avatars.discourse-cdn.com/v4/letter/d/9fc29f/32.png) [@Danni666](https://discuss.jsonapi.org/u/Danni666)\
**Post date:** [March 23, 2024, 1:42am UTC](https://discuss.jsonapi.org/t/confusion-on-relationships-in-author-example/2695/6 "2024-03-23T01:42:37Z")

</div>

Continuing the discussion from [Confusion on relationships in author example](https://discuss.jsonapi.org/t/confusion-on-relationships-in-author-example/2695/2):
