Search code examples
google-mapsgoogle-places-apigoogle-places-autocomplete

Google Places API response structure changed - Id field removed from predictions


In the below API results:

https://maps.googleapis.com/maps/api/place/autocomplete/json?input=bangalore&language=&components=country%3AIN&radius=3200&location=None%2CNone&types=%28regions%29&sensor=false&key=

Predictions results does not have id field in some cases.
Like description: "Bangalore South, Karnataka, India" does not have id.

Is this change in response structure expected?


Solution

  • As also mentioned in this SO post, the id field has been deprecated as of June 2014 so it is not guaranteed that this field will always be returned. In replacement, you'll need to use the "place_id" field moving forward which uniquely identifies a place.

    This has also been answered in Google's Public Issue Tracker here: https://issuetracker.google.com/issues/134893143