Skip to content

docs(inclusion): cherrypcik documentation from JR #156

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

Merged
merged 1 commit into from
Sep 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions couscous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ menu:
filtering:
text: Filtering
relativeUrl: filtering.html
includingRelationships:
text: Including Relationships
relativeUrl: includingRelationships.html
pagination:
text: Pagination
relativeUrl: pagination.html
Expand Down
54 changes: 54 additions & 0 deletions docs/IncludingRelationships.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
currentMenu: includingRelationships
---

# Including Relationships

JADNC supports [request include params](http://jsonapi-resources.com/v0.9/guide/resources.html#Included-relationships-side-loading-resources) out of the box, for side loading related resources.

Here’s an example from the spec:

```http
GET /articles/1?include=comments HTTP/1.1
Accept: application/vnd.api+json
```

Will get you the following payload:

```json
{
"data": {
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON API paints my bikeshed!"
},
"relationships": {
"comments": {
"links": {
"self": "http://example.com/articles/1/relationships/comments",
"related": "http://example.com/articles/1/comments"
},
"data": [
{ "type": "comments", "id": "5" },
{ "type": "comments", "id": "12" }
]
}
}
},
"included": [{
"type": "comments",
"id": "5",
"attributes": {
"body": "First!"
}
}, {
"type": "comments",
"id": "12",
"attributes": {
"body": "I like XML better"
}
}]
}
```