-
https://www.haloapi.com/metadata/hw2/game-objects?startAt=0 <- Works Perfectly - https://www.haloapi.com/metadata/hw2/game-objects?startAt=100 <- Works Perfectly - https://www.haloapi.com/metadata/hw2/game-objects?startAt=200 **<- ‘System.AggregateException’ at task.Wait()**Here is the relevent code:
task = Task.Run(() => getGameObjects());
task.Wait();
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?