Noam
Noam

Reputation: 862

Google places details API call return NOT_FOUND for an existing autocomplete reference

I have a problem maybe someone had the same issue.

I am calling google places autocomplete api call.

Then i am presenting the user with the results and he can select the place. Base on the selection i am making places details call and retrieve the details of the place.

My problem is that some cases the details service return NOT_FOUND. the full response looks something like this

    {\n   \"debug_info\" : [],\n   \"html_attributions\" : [],\n   \"status\" 
: \"NOT_FOUND\"\n}\n

Based on google api documentation, NOT_FOUND for place details is: NOT_FOUND indicates that the referenced location was not found in the Places database.

But i got this Reference just 1 sec ago from autocomplete service call!

Anyone has the same problem?

Thanks, Noam

Upvotes: 14

Views: 2656

Answers (2)

DjGimli
DjGimli

Reputation: 101

It could also be due to the fact that the business is closed.

https://developers.google.com/maps/documentation/places/web-service/search-find-place#id-errors

I had a similar issue when using the Find Place endpoint. I would get a successful response and a place_id returned and then calling the Details endpoint would return a NOT_FOUND error.

After adding business_status to the fields on my initial request to the FindPlace endpoint would return:

GET https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=gtdc.org&inputtype=textquery&languagecode=en&fields=place_id,business_status&key={{googlePlacesApiKey}}&locationbias=circle:{{radius}}@{{latitude}},{{longitude}}

Response:

{
    "candidates": [
        {
            "business_status": "CLOSED_PERMANENTLY",
            "place_id": "ChIJ7buuHhrhwogR_eWFgXkNyjY"
        }
    ],
    "status": "OK"
}

Essentially you just have to ignore any results where the status is CLOSED_PERMANENTLY as these will not work on the details endpoint.

Unfortunately there doesn't seem to be any way of returning the business_status on the Autocomplete endpoint but might be the same issue you are seeing.

Upvotes: 0

Brett
Brett

Reputation: 2399

There are two indexes here, one for the autocomplete suggest and one for the map details. You are seeing the results of the two indexes being updated at different times. If you supply the address in question, I can confirm with the appropriate teams, or you can just wait a couple of days for the indexes to come back into sync.

Upvotes: 7

Related Questions