Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Relationships #12

Open
11 tasks
niden opened this issue Aug 4, 2018 · 0 comments
Open
11 tasks

Introduce Relationships #12

niden opened this issue Aug 4, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@niden
Copy link
Member

niden commented Aug 4, 2018

  • 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.

@niden niden added the enhancement New feature or request label Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant