Relationships type

Can a relationship point to different types of resources?

ie… is the following response legal?

{
“links”: {
“self”: “/house/1/relationships/owner”,
“related”: “/house/1/owner”
},
“data”: [{
“type”: “people”,
“id”: “12”
},
{
“type”:“company”,
“id”: “44”
}]
}

Based on this I’d say it is legal.

A server MUST return 409 Conflict when processing a POST request in
which the resource object’s type is not among the type(s) that constitute the
collection represented by the endpoint.

Note the use of the plural: type(s)

I would argue that it’s the reason for the type attribute in the first place, no?

1 Like