TheAlbear
TheAlbear

Reputation: 5585

Google Places API missing ID and Referance in response

I am using the Google Places API with the following search string

https://maps.googleapis.com/maps/api/place/queryautocomplete/json?key=AIzaSyDryrzCJoKA-XeN-f3Q2KDPdJHd27Nl7CoM&sensor=true&input=bri

The result back look like this:

{
   "predictions" : [
      {
         "description" : "Bristol, United Kingdom",
         "matched_substrings" : [
            {
               "length" : 3,
               "offset" : 0
            }
         ],
         "terms" : [
            {
               "offset" : 0,
               "value" : "Bristol"
            },
            {
               "offset" : 9,
               "value" : "United Kingdom"
            }
         ]
      }
   ... etc etc
   ],
   "status" : "OK"
}

I can't see an 'id' or 'reference' property on any of the returned predictions results which is needed in order to then request the full details from the Google Places Details API.

Their documentation says I should see both these items. https://developers.google.com/places/documentation/autocomplete

Any one know what i am doing wrong?

Upvotes: 1

Views: 411

Answers (2)

Isidro Moran
Isidro Moran

Reputation: 330

You're using the wrong method. You have to use autocomplete: https://developers.google.com/places/documentation/autocomplete

Upvotes: 2

Hussani
Hussani

Reputation: 21

You're using the "queryautocomplete" service. Query Autocomplete not returns the place id field. Try use autocomplete service with this url:

https://maps.googleapis.com/maps/api/place/autocomplete/json?key=AIzaSyDryrzCJoKA-XeN-f3Q2KDPdJHd27Nl7CoM&sensor=true&input=bri

Upvotes: 1

Related Questions