What does "self" point to when a related resource was requested?


I request a post resource, which declares a relationship to an author. I now request that author via /post/123/author. What should self in the links section point to?

Should it point to /post/123/author or should it point to /user/456, assuming user 456 is the author of post 123.


The self link in the resource should point to the canonical link for the resource (i.e. /user/456) while the self link in the top level links should reference the request URL (i.e. /post/123/author).

See http://jsonapi.org/format/#document-top-level

The top-level links object MAY contain the following members:

  • self: the link that generated the current response document.