Get children of multiple roots expected json result

36 Views Asked by At

I tried to find good sorces for finding out what is the right way of doing it but i couldnt find anything realy...

So the problem is that if i want to get children of multiple roots i would call that via the following REST route.

GET /children?roots=2,4

The result could now have two possiblities

1.

[
    {
        root: 2,
        children: [1, 2]
    },
    {
        root: 4,
        children: [3, 4]
    }
]
[
    {
        child : 1
        root : 2
    },
    {
        child : 2
        root : 2
    },
    {
        child : 3
        root : 4
    },
    {
        child : 4
        root : 4
    }
]

Which one would be the expected result and why? I Personally would go for the first aproch.

0

There are 0 best solutions below