1
Developed on an Asp.net mvc I intend to implement an HTTP request
that with this part of code the meteorologies present me a "list" with the parameters of the query data_de_leitura=2016-11-11&hora_de_leitura={null}
i.e., 3 entries for the query that is added to the url
example:
api/Metereologias?data_de_leitura=2016-11-11&hora_de_leitura={null}
The result obtained regardless of the date and time value is always the same, all the weather of the api url.
var client = WebApiHttpClient.GetClient();
string path = "api/Metereologias?data_de_leitura=" + data + "hora_de_leitura=" + hora;
HttpResponseMessage response = await client.GetAsync(path);
if (response.IsSuccessStatusCode)
{
string content = await response.Content.ReadAsStringAsync();
var metereologias =
JsonConvert.DeserializeObject<IEnumerable<MetereologiaDTO>>(content);
await GetPois();
return View(metereologias);
on the api side displays a method in the controller to handle this data
public List<MetereologiaDTO> GetMetereologiasSearchDataeHora(string data_de_leitura, string hora_de_leitura)
{
List<MetereologiaDTO> result = new List<MetereologiaDTO>();
result = verificarData(result, data_de_leitura);
result = verificarHora(result, hora_de_leitura);
return result;
}
the result displayed is in the same as if it were only "api/weather"
– Daniel Dias
@Daniel Dias, no matter what parameters you pass in the API, the variable weather always has the same information but should bring other data right? If yes, should bring other data, should be something with the API. Tried to see the API?
– Fabio Silva Lima
Is the api tested example for "http://localhost:50634/api/Weather? data_de_leitura=2016-11-11&hora_de_leitura={null}" displays 3 weather logies and not the 5 total database
– Daniel Dias