title: How to send a Google Places Search Request with Java
body: <p>I need to search Goolge Places Pages by long/lat for any banks in the area of 20m.
  This <a href="https://developers.google.com/maps/documentation/javascript/places#place_search_requests" rel="noreferrer">Google Places Doc</a> describes how to do it with JavaScript. They are using a <code>google.maps.LatLng</code> Object that i don't have in Java.</p>
  
  <p>Does anyone now how to call the Service?</p>
  
  <p>Maybe there is also an Java API for Goolge Places?</p>
  
  <p>Best Regards,
  Christian.</p>
  
  <p>Edit 1:</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/10865738/how-to-show-near-places-using-google-places-api">someone</a> constructing the url like this:</p>
  
  <pre><code>String url = baseUrl + "location=" + lat + "," + lon + "&amp;" +
                   "radius=" + searchRadius + "&amp;" + types + "&amp;" + "sensor=true" +
                   "&amp;" + "key=" + googleAPIKey;
  </code></pre>
  
  <p>Answer: Edit 2:</p>
  
  <p>I because of the post above i found out how to do it. This is a example how to send the request:</p>
  
  <pre><code>public class GooglePlacesClient
  {
      private static final String GOOGLE_API_KEY  = "***";
  
      private final HttpClient    client          = new DefaultHttpClient();
  
      public static void main(final String[] args) throws ParseException, IOException, URISyntaxException
      {
          new GooglePlacesClient().performSearch("establishment", 8.6668310, 50.1093060);
      }
  
      public void performSearch(final String types, final double lon, final double lat) throws ParseException, IOException, URISyntaxException
      {
          final URIBuilder builder = new URIBuilder().setScheme("https").setHost("maps.googleapis.com").setPath("/maps/api/place/search/json");
  
          builder.addParameter("location", lat + "," + lon);
          builder.addParameter("radius", "5");
          builder.addParameter("types", types);
          builder.addParameter("sensor", "true");
          builder.addParameter("key", GooglePlacesClient.GOOGLE_API_KEY);
  
          final HttpUriRequest request = new HttpGet(builder.build());
  
          final HttpResponse execute = this.client.execute(request);
  
          final String response = EntityUtils.toString(execute.getEntity());
  
          System.out.println(response);
      }
  
  }
  </code></pre>