I tried the following and I am checking with you if this will work: -
NetworkManager.cs file
public class NetworkManager
{
public CurrentWeather GetCurrentWeather(int id)
{
string url = $"http://api.openweathermap.org/data/2.5/weather?id={id}&units=metric&appid=921e83b9da8a40a760ad74d5cedd6bbd";
using var httpClient = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "http://api.openweathermap.org/data/2.5/weather?id={id}&units=metric&appid=921e83b9da8a40a760ad74d5cedd6bbd");
string responseJson = string.Empty;
var response = httpClient.Send(request);
using var reader = new StreamReader(response.Content.ReadAsStream());
var responseBody = reader.ReadToEnd();
using (StreamReader streamReader = new StreamReader(responseBody))
{
responseJson = streamReader.ReadToEnd();
}
reader.Close();
return JsonConvert.DeserializeObject<CurrentWeather>(responseJson);
});
}
}
}