Skip to content

Commit 7c89e89

Browse files
authored
Merge pull request #156 from Research-Institute/docs/#147
docs(inclusion): cherrypcik documentation from JR
2 parents e67c7bc + 6a4c950 commit 7c89e89

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

couscous.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ menu:
7878
filtering:
7979
text: Filtering
8080
relativeUrl: filtering.html
81+
includingRelationships:
82+
text: Including Relationships
83+
relativeUrl: includingRelationships.html
8184
pagination:
8285
text: Pagination
8386
relativeUrl: pagination.html

docs/IncludingRelationships.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
currentMenu: includingRelationships
3+
---
4+
5+
# Including Relationships
6+
7+
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.
8+
9+
Here’s an example from the spec:
10+
11+
```http
12+
GET /articles/1?include=comments HTTP/1.1
13+
Accept: application/vnd.api+json
14+
```
15+
16+
Will get you the following payload:
17+
18+
```json
19+
{
20+
"data": {
21+
"type": "articles",
22+
"id": "1",
23+
"attributes": {
24+
"title": "JSON API paints my bikeshed!"
25+
},
26+
"relationships": {
27+
"comments": {
28+
"links": {
29+
"self": "http://example.com/articles/1/relationships/comments",
30+
"related": "http://example.com/articles/1/comments"
31+
},
32+
"data": [
33+
{ "type": "comments", "id": "5" },
34+
{ "type": "comments", "id": "12" }
35+
]
36+
}
37+
}
38+
},
39+
"included": [{
40+
"type": "comments",
41+
"id": "5",
42+
"attributes": {
43+
"body": "First!"
44+
}
45+
}, {
46+
"type": "comments",
47+
"id": "12",
48+
"attributes": {
49+
"body": "I like XML better"
50+
}
51+
}]
52+
}
53+
```
54+

0 commit comments

Comments
 (0)