We recommend refreshing cached place IDs if they are more than 12 months old. You can refresh place IDs free of charge, by making a Place Details - Place ID Refresh request, specifying only place_id field in the fields request parameter as shown below (in addition to the placeid request parameter):
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJb0PV8jOftUwRypG5jRXPCzs&fields=place_id&key=<YOUR_API_KEY>
If successful, the response returns a status: OK and the refreshed place_id in the results:
{
"html_attributions": [],
"result": {
"place_id": "ChIJb0PV8jOftUwRypG5jRXPCzs"
},
"status": "OK"
}
Getting NOT_FOUND and INVALID_REQUEST Status Codes
A response status of NOT_FOUND indicates that a place ID is already obsolete. A place ID may become obsolete if a business closes, moves to a new location or if a large-scale update on Google Maps database has been implemented. In this case, you can either re-issue the previous API call that retrieved the old place_id or make a new Find Place ID Only request which is also free of charge. Sample request below will accomplish that as a Find Place request by default only returns place_id field.
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Starbucks+Daniel+Webster&inputtype=textquery&key=
On the other hand, a response status of INVALID_REQUEST means the specified value in the placeid request parameter is invalid (id is truncated or modified). For this, make sure that the full value of the place ID is retrieved and then re-send the request.
Comments
0 comments
Please sign in to leave a comment.