What is the best practice in relation to this? Can you say that it depends on the application or is there any recommendation that indicates that one option is better than another?
The two options are as follows:
1 - Return nested objects
{
"id": 1,
"title": "Game A",
"developer": "Developer DEF",
"releaseDate": "2015-01-01",
"platforms": [
{"id":1,"name":"Xbox"},
{"id":2,"name":"Playstation"}
]
}
2 - Return links to that objects
{
"id": 1,
"title": "Game A",
"developer": "Developer DEF",
"releaseDate": "2015-01-01",
"platforms": [
{"_self": "http://api.example.com/games/1/platforms/53"},
{"_self": "http://api.example.com/games/1/platforms/34"},
]
}