Can a Collection Have a Relationship?


#1

Is the following valid (where a collection has a relationship):

{
“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
}
}
}
}, {
“type”: “articles”,
“id”: “2”,
“attributes”: {
“title”: “JSON API paints my house!”
},
“links”: {
“self”: “http://example.com/articles/2
},
“relationships”: {
“author”: {
“links”: {
“self”: “http://example.com/articles/2/relationships/author”,
“related”: “http://example.com/articles/2/author
}
}
}
}],
“relationships”: {
“newspapers”: {
“links”: {
“self”: “http://example.com/articles/newspapers”,
“related”: “http://example.com/articles/newspapers
}
}
}
}


#2

Please format your JSON payload – humans are bad at parsing non-indented JSON.