I'm create a RESTful API using ASP.NET Web API. I am trying to work out the best way of limiting the amount of data child objects show.
To explain, I have three entities, Objects, Channels and ChannelData. An object can have 0 or more Channels and a Channel can have 0 or more ChannelData (and usually 1000s).
I want the following endpoints:
/api/Objects
- Returns the JSON list of objects and their channels but not the ChannelData (maybe summary data instead e.g. the amount of data etc).
/api/Objects/{{objectId}}/ChannelData?channel={{channelName}}
- Returns all the data in JSON for a particular channel for a particular object.
By default, Web API tries to show everything in /api/Objects including 1000s of ChannelData objects. What is the best way of preventing the array of ChannelData from appearing for a specific endpoint?