http://jsonapi.org/format/#document-compound-documents
यौगिक दस्तावेजों से
"पूर्ण संबंध" की आवश्यकता होती है, जिसका अर्थ है कि हर शामिल संसाधन एक ही दस्तावेज़ में कम से कम एक संसाधन पहचानकर्ता वस्तु द्वारा की पहचान किया जाना चाहिए। ये संसाधन पहचानकर्ता ऑब्जेक्ट या तो प्राथमिक डेटा हो सकते हैं या प्राथमिक के भीतर संसाधन संसाधन का प्रतिनिधित्व करते हैं या संसाधन शामिल कर सकते हैं। पूर्ण लिंकेज आवश्यकता का एकमात्र अपवाद तब होता है जब संबंध फ़ील्ड जो अन्यथा लिंकेज डेटा को स्पैस फ़ील्ड के माध्यम से बाहर रखा जाता है।
{
"data": [{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON API paints my bikeshed!"
},
"links": {
"self": "http://example.com/articles/1"
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/articles/1/author"
},
"data": { "type": "people", "id": "9" }
},
"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": "people",
"id": "9",
"attributes": {
"first-name": "Dan",
"last-name": "Gebhardt",
"twitter": "dgeb"
},
"links": {
"self": "http://example.com/people/9"
}
}, {
"type": "comments",
"id": "5",
"attributes": {
"body": "First!"
},
"links": {
"self": "http://example.com/comments/5"
}
}, {
"type": "comments",
"id": "12",
"attributes": {
"body": "I like XML better"
},
"links": {
"self": "http://example.com/comments/12"
}
}]
}
यह मानता है कि आप संसाधनों आप बना रहे हैं की आईडी, रिश्ते में लाना जानते हैं और दस्तावेज शामिल थे। हालांकि मुझे लगता है कि आप अज्ञात आईडी को विशेष मान दे सकते हैं और सर्वर उन्हें बना सकते हैं। – Rob