Skip to content
VirtualLP Virtual Learning Platform
Web Services CC-P04 intermediate

Practical 4: Place search and geolocation with the Google Maps REST APIs

Write a Java client that calls the Google Maps Geocoding and Places Text Search APIs: configure the API key, build the HTTP request, parse the JSON, and handle REQUEST_DENIED and ZERO_RESULTS responses.

What you'll do

  • Configure an API key outside the code
  • Build REST requests with java.net.http.HttpClient
  • Parse JSON responses with org.json
  • Handle error statuses returned by the API

Lab tasks

  1. 1 Run without a valid key
  2. 2 Configure the API key
  3. 3 Print the address and coordinates
  4. 4 Search places with the Places API
  5. 5 Handle a place that does not exist