/// <summary> /// Fetch sensor history within the timespan and report the number of results. /// Check private variables 'startTime' and 'endTime' for the timespan /// and adjust these as needed! /// </summary> private static async Task GetSensorHistoryCount(string sensorId) { Console.WriteLine("Test /api/sensor/history"); Console.WriteLine("Get Sensor History (y/n)? "); string input = Console.ReadLine(); if (input == "y" || input == "Y") { // Sample JSON to send JObject json = new JObject { ["sensorId"] = sensorId, ["startTime"] = startTime, ["endTime"] = endTime }; try { List <SensorHistoryLog> logs = await SensorApi.SensorHistory(json.ToString()); Console.WriteLine("Number of results: " + logs.Count + "\n"); } catch (Exception ex) { Console.WriteLine("Method Error: " + ex.Message + "\n"); } } }