Hello, guys!
I have this scenario:
Channel-Applications belongsTo Channel
Channel-Applications hasMany Application-Features
Application-Feature belongsTo Channel-Applications
Application-Features belongsTo Features
Channel hasMany Features
Feature hasMany Application-Features
Feature hasMany Channels
And that’s the return of my API:
{
"data":[
{
"type":"channel-applications",
"id":"2",
"attributes":{
"name":"Application1",
"channel-id":1,
"client-id":"123"
},
"relationships":{
"application-features":{
"data":[
{
"type":"application-features",
"id":"3"
}
]
}
}
},
{
"type":"channel-applications",
"id":"4",
"attributes":{
"name":"Application2",
"channel-id":2,
"client-id":"456"
},
"relationships":{
"application-features":{
"data":[
{
"type":"application-features",
"id":"7"
}
]
}
}
},
{
"type":"channel-applications",
"id":"5",
"attributes":{
"name":"Application3",
"channel-id":3,
"client-id":"001"
},
"relationships":{
"application-features":{
"data":[
{
"type":"application-features",
"id":"9"
},
{
"type":"application-features",
"id":"10"
},
{
"type":"application-features",
"id":"11"
},
{
"type":"application-features",
"id":"12"
}
]
}
}
}
],
"included":[
{
"type":"application-features",
"id":"3",
"attributes":{
"channel-application-id":2,
"feature-id":3,
"scope":"teste1, teste2, teste3",
"connect-type":"script"
}
},
{
"type":"application-features",
"id":"7",
"attributes":{
"channel-application-id":4,
"feature-id":3,
"scope":"",
"connect-type":"redirect"
}
},
{
"type":"application-features",
"id":"9",
"attributes":{
"channel-application-id":5,
"feature-id":1,
"scope":"teste4, teste5",
"connect-type":"redirect"
}
},
{
"type":"application-features",
"id":"10",
"attributes":{
"channel-application-id":5,
"feature-id":2,
"scope":"",
"connect-type":"password"
}
},
{
"type":"application-features",
"id":"11",
"attributes":{
"channel-application-id":5,
"feature-id":3,
"scope":"",
"connect-type":"password"
}
},
{
"type":"application-features",
"id":"12",
"attributes":{
"channel-application-id":5,
"feature-id":4,
"scope":"",
"connect-type":"password"
}
}
]
}
My questions: My structure is correctly? My included is correctly? May I have to use Included or Links (related/self)?