Skip to content

Introduce Relationships #12

Description

@niden
  • A server MUST support fetching relationship data for every relationship URL provided as a self link as part of a relationship’s links object.
GET /articles/1/relationships/author HTTP/1.1
Accept: application/vnd.api+json

Responses

200 OK
  • A server MUST respond to a successful request to fetch a relationship with a 200 OK response.
  • The primary data in the response document MUST match the appropriate value for resource linkage, as described above for relationship objects.
  • The top-level links object MAY contain self and related links, as described above for relationship objects.
  • A one to one relationship returns the object.
  • One to many an array of objects.
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json

{
  "links": {
    "self": "/articles/1/relationships/tags",
    "related": "/articles/1/tags"
  },
  "data": [
    { "type": "tags", "id": "2" },
    { "type": "tags", "id": "3" }
  ]
}
  • No data returns an empty array
404 Not Found
  • A server MUST return 404 Not Found when processing a request to fetch a relationship link URL that does not exist. Note: This can happen when the parent resource of the relationship does not exist. For example, when /articles/1 does not exist, request to /articles/1/relationships/tags returns 404 Not Found.

  • If a relationship link URL exists but the relationship is empty, then 200 OK MUST be returned, as described above.

  • A server MAY respond with other HTTP status codes.

  • A server MAY include error details with error responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status
    Released

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions