Christian
Christian

Reputation: 162

C# Webclient Download String Zero Result in Json File

I have a Problem with the webClient.Download("URI") function. It worked, since I had to change the URL to https (what I suggest). If I paste my request URI in the Browser i get a valid Json String, if I call it with the DownloadString("URI") method, i get Zero Results as a result My Code contains a key, just removed it for this post here here is my Code:

var json = "";

Console.WriteLine("Connect zur Google API Geo Coding API");
locations = locations.Replace(" ", "+");
//request the google geocoding api. limit of 2500 requests/day
String requestUri = "https://maps.googleapis.com/maps/api/geocode/json?address=Serba,++Am+Schwemmberg,+Germany";
Console.WriteLine("Hat geklappt");
//get the json string
 Console.WriteLine("starte den download des json");

 var webClient = new WebClient();
//here it Returns "Zero result"

 json = webClient.DownloadString(requestUri);

 Console.WriteLine("Download des json beendet");

Upvotes: 0

Views: 386

Answers (1)

Sylence
Sylence

Reputation: 3073

The documentation states that you have to provide the key parameter which you didn't.

Upvotes: 1

Related Questions