So I have implemented a C# RESTful API for a recent side project and I have noticed that when making a GET request to the API I am provided with a lot of data when I only need around 8 or so entries, specifically the newest entries.
I have narrowed down this too one of two different issues, I believe my below fall back code to be somewhat primitive following a generic class structure that is created when deseralize object is called. The main problem could be because I am using a web client to download the JSON data then passing it over, could this be more sophisticated to allow the functionality I want?
using (WebClient wc = new WebClient())
var json = wc.DownloadString("//api call here");
jsonData = JsonConvert.DeserializeObject<List<T>>(json);
To provide clarity on how this problem was solved it was mostly done through creating specific triggers on the existing API that allowed SQL to be run which is something that was I previously didn't know.
This allowed me to limit the amount of data that was returned through a generic sql command. A separate call was created on the API which returned all of the data and loaded the later objects into the dom using an async function.
Yes you can use SQL with api's generated by C# magic.