I want to create a rest-webservice which returns json-objects. How should I design the response of the api-calls? For example I got a class "Profil". Each Profil has a list of "Schedules".
When I want to get a profil what should I return?
Only the profil-fields (and call after that my schedules)
{
"id": 1,
"name":"Peter",
"schedule_ids":[20,21]
}
or the profil-object with an array of schedules?
{
"id": 1,
"name":"Peter",
"schedules":
[
{
"id":20,
"startDay":"2015/3/3"
},
{
"id":21,
"startDay":"2015/9/10"
}
]
}
Are there any software design patterns for webservice models?
Aucun commentaire:
Enregistrer un commentaire