You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"content": "Have no fear, sers, your king is safe."
313
319
},
314
320
"links": {
315
-
"self": "/comments/1",
321
+
"self": "/comments/1"
322
+
},
323
+
"relationships": {
316
324
"user": {
317
325
"self": "/comments/1/links/user",
318
326
"related": "/comments/1/user",
319
327
"linkage": {
320
328
"type": "users",
321
329
"id": "2"
322
330
}
331
+
},
332
+
"post": {
333
+
"self": "/comments/1/links/post",
334
+
"related": "/comments/1/post"
323
335
}
324
336
}
325
337
},
@@ -331,19 +343,20 @@ Returns:
331
343
},
332
344
"links": {
333
345
"self": "/users/2"
334
-
}
346
+
},
347
+
"relationships": {}
335
348
}
336
349
]
337
350
}
338
351
```
339
352
340
353
Notice a few things:
341
-
* The [primary data](http://jsonapi.org/format/#document-structure-top-level) now includes "linkage" information for each relationship that was included.
354
+
* The [primary data](http://jsonapi.org/format/#document-structure-top-level)relationships now include "linkage" information for each relationship that was included.
342
355
* The related objects themselves are loaded in the top-level `included` member.
343
356
* The related objects _also_ include "linkage" information when a deeper relationship is also present in the compound document. This is a very powerful feature of the JSON:API spec, and allows you to deeply link complicated relationships all in the same document and in a single HTTP response. JSONAPI::Serializers automatically includes the correct linkage information for whatever `include` paths you specify. This conforms to this part of the spec:
344
357
345
-
> Note: Resource linkage in a compound document allows a client to link together all of the included resource objects without having to GET any relationship URLs.
> Note: Full linkage ensures that included resources are related to either the primary data (which could be resource objects or resource identifier objects) or to each other.
0 commit comments