I did this request in postman and it works fine
But when I try to do the same request using RestSharp I´m having this response:
my csharp code:
public string FindWeatherStation(string query)
{
RestClient client = new RestClient(new Uri($"https://api.meteostat.net/v2/stations/search"));
var request = new RestRequest(Method.GET);
request.AddHeader("x-api-key", "mykey");
request.AddParameter("query", query);
IRestResponse response = client.Execute(request);
var result = response.Content;
return result;
}
the query value is vancouver as well
What am I doing wrong?
Creating the RestClient object by simply pass the url as string:
RestClient client = new RestClient("https://api.meteostat.net/v2/stations/search");
Then using ParameterType.RequestBody as the third parameter to the AddParameter method:
request.AddParameter("query", query, ParameterType.RequestBody);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.