Can't get game objects past 200

private static async Task getGameObjects()
{
for (int i = 0; i < 3; i++)
{
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Add(“Ocp-Apim-Subscription-Key”, subKey);
string url = “https://www.haloapi.com/metadata/hw2/game-objects?startAt=” + (i*100).ToString();
var requestMessage = new HttpRequestMessage
{
RequestUri = new Uri(url)
};
var responseMessage = await httpClient.SendAsync(requestMessage);
var content = await responseMessage.Content.ReadAsStringAsync();
string JSON = content.ToString();
gameObjects = JsonConvert.DeserializeObject<KYEGameObjects.AllData>(JSON);
}
}
As said above, it works fine for 0 and 100 but not 200. Even if I just type the string in with “startAt=200” even without the forloop it still doesn’t work. What’s going on here, how can I get the game objects above 200?

Check the inner exceptions on your aggregate exception.

I suspect your ‘KYEGameObjects.AllData’ model doesn’t match the response. Some of the turret objects (and others) that are only found in the 200+ range have a null StandardSupplyCost, StandardPopulationCost, and StandardEnergyCost value. Even though the documentation doesn’t say that the are nullable.

If your model has these properties as a non-nullable int, it’ll fail to deserialize and you’ll see an exception like:

> Error converting value {null} to type ‘System.Int32’. Path ‘ContentItems[4].View.HW2Object.StandardEnergyCost’ …

> 2753093343646559;2:
> Check the inner exceptions on your aggregate exception.
>
> I suspect your ‘KYEGameObjects.AllData’ model doesn’t match the response. Some of the turret objects (and others) that are only found in the 200+ range have a null StandardSupplyCost, StandardPopulationCost, and StandardEnergyCost value. Even though the documentation doesn’t say that the are nullable.
>
> If your model has these properties as a non-nullable int, it’ll fail to deserialize and you’ll see an exception like:
>
>
>
>
> > Error converting value {null} to type ‘System.Int32’. Path ‘ContentItems[4].View.HW2Object.StandardEnergyCost’ …

Oh right, how can I prevent this from happening and still get all the info?