Reputation: 69
I am trying to connect to google maps using the following url and code to fetch nearby places, but I am getting invalid request. What seems to be the issue here?
let url = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=...&location=49.1804488%2C-122.7851227'
let results = await axios.get(url)
console.log(results.data)
console.log(results.status)
console.log(results.error_message)
console.log(results.info_messages)
Upvotes: 1
Views: 859
Reputation: 179
For me, I accidentally switched the values for latitude
and longitude
causing the issue below.
{'html_attributions': [], 'results': [], 'status': 'INVALID_REQUEST'}
I put the correct values then the request succeeded.
Upvotes: 0
Reputation: 161334
The documentation says that only location
is required. That seems to be wrong, adding radius
to the query returns a result.
This works:
This doesn't work (returns "status" : "INVALID_REQUEST"
):
Upvotes: 4