HI All,
Has anyone used the Google Places API to do text searches, and if so, can you please help me with how to get the API Key to work. The code I am using is as follows.
I have created the API Key through the developer console and switched on the Places API.
I have tried with multiple keys but the one I believe should work is a Browser based key. It is not linked to any referrers, so should work. I have tried it on the browser on my desktop and phone and the request works. The one thing I am not 100% sure on is the format of the POST request. Can anyone see any problems with what I have there? I am trying to use SandroProxy to intercept the calls and see if I am missing something but am getting other problems there around the ssl certificate.
The error I am getting is in the Job.GetString:
{
"error_message" : "An internal error was found for this API project.",
"html_attributions" : [],
"results" : [],
"status" : "REQUEST_DENIED"
}
Any help greatly appreciated...
Has anyone used the Google Places API to do text searches, and if so, can you please help me with how to get the API Key to work. The code I am using is as follows.
I have created the API Key through the developer console and switched on the Places API.
I have tried with multiple keys but the one I believe should work is a Browser based key. It is not linked to any referrers, so should work. I have tried it on the browser on my desktop and phone and the request works. The one thing I am not 100% sure on is the format of the POST request. Can anyone see any problems with what I have there? I am trying to use SandroProxy to intercept the calls and see if I am missing something but am getting other problems there around the ssl certificate.
B4X:
Public Sub GetPlaces
Dim Job As HttpJob
Dim iDistance As Int = 1
Dim url As String = "https://maps.googleapis.com/maps/api/place/textsearch/json"
Dim query As String = "?query=French+restaurants&Location=" & currLat & "," & currLng & "&radius=1000m&types=food&key=" & Constants.GOOGLE_PLACES_WEB_API_KEY
Log(url&query)
Job.Initialize("GetEateries", Me)
Job.PostString(url,query)
'
Job.GetRequest.SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36")
Job.GetRequest.SetContentType("application/x-www-form-urlencoded")
End Sub
The error I am getting is in the Job.GetString:
{
"error_message" : "An internal error was found for this API project.",
"html_attributions" : [],
"results" : [],
"status" : "REQUEST_DENIED"
}
Any help greatly appreciated...