Vlad Vlad
Vlad Vlad

Reputation: 103

What is wrong with google autocomplete?

I make a request: curl -s "https://maps.googleapis.com/maps/api/place/autocomplete/json?input=штат+нью+йорк&key=< key >"

Get result: { "predictions" : [], "status" : "ZERO_RESULTS" }

But when I pass the link in the browser - I get correct result :(

P.S. "штат+нью+йорк" = "state+new+york" ;)


UPDATE

Problem in word "штат" [ukrainian\russian] ("state" - on english) and only in curl request

terminal

enter image description here

Upvotes: 0

Views: 1173

Answers (1)

Adeel Javed
Adeel Javed

Reputation: 372

you need to encode the input string because of the spaces(or for any characters) used in the input as browser automatically encode those spaces

it should be like this

https://maps.googleapis.com/maps/api/place/autocomplete/json?input=state%20new%20york&key=

as you can see the input is state new york

for language related query and results you should also add language parameter in your query

https://maps.googleapis.com/maps/api/place/autocomplete/json?input=штат+нью+йорк&language=ru&key=

After adding language you will get required results

Upvotes: 3

Related Questions