Hello,
I'm working on the design of a new read only API and i wanted to grab some opinions on how best to represent the following data structure via API resources.
So the following parent --> child structure Exists
Countries --> Regions --> Authorities --> Establishments
I've set each of these types as resources in the API so...
GET api/Countries - returns a list of countries
GET api/Countries/1 - returns a single country by Id
Now my question is should i also include a child link here to prompt consumers to grab child data so..
GET api/Countries/1/regions - returns a list of regions in country 1
I didn't want to go any further into the hierarchy, but felt if I prompted the consumer by exposing the next child resource they would be able to pick up the structure as the response data will include links to the resource, so in the above example a region item would have a link to api/region/1.
I also have some queries regarding returning a full object graph vs a list of links vs provided basic or detail options as well as how to handle search functionality but i wanted to get the overall structure correct first.
Many thanks
Andy