Hello,
I am working with two resources: Buildings and Characteristics. The Characteristics stores all the definitions that a building could have. When an characteristic is applied to a building, it receives a value. For example, the “number_desks” characteristic might have a value of 5.
My question is: Can I add this relational data to the relationship resource, and is it possible to retrieve this data through a query?
// /building/4
{
"data": {
"type": "building",
"id": "4",
"attributes": {
"name": "Empire State Building"
},
"relationships": {
"characteristics": {
"links": {
"self": "buildings/1/relationships/characteristics",
"related": "buildings/1/characteristics"
},
"data": [
{
"type": "characteristic",
"id": "9", // characteristic-id for number_desks
"attributes": {
"value": "5"
}
},
{ ...}
]
}
}
},
"links": {
"self": "buildings/4"
}
}
Is this approach advisable, or do you recommend an alternative solution?
thanks for your feedback!
Greetings!