Reputation: 51
I am using four square API to display the auto suggestions when user types a word. I use:
$http.get('https://api.foursquare.com/v2/venues/search?&near='+input+'&query=' +input+'&intent=gloabal&limit=5&oauth_token=D5STL1YLFPPGLOF121W....&v=2016...')
But I am not getting the exact results. Sometimes it shows nothing giving empty objects and also in different languages like tamil, urdu, etc...
Then I tried with an example - taj mahal. If I type taj,taj ma, taj maha like that... It doesn't show anything... API suggests taj mahal only when i type taj mahal fully in the search box.
Can anyone provide some insight?
Upvotes: 0
Views: 284
Reputation: 132
Just trying to debug this for you. Here are some glaring things that might be the issue here:
a) It appears that your intent specifies gloabal
vs global
, which would likely default to the intent checkin
via https://developer.foursquare.com/docs/venues/search
b) Could be an issue with your search e.g. searching for the taj mahal near the taj mahal.
To get into the details more, it might help to dig into some of the raw HTTP requests being sent to Foursquare.
Here is a sample CURL command for finding 'food' near the Taj Mahal.
curl -v 'https://api.foursquare.com/v2/venues/search?&near=taj%20mahal&query=food&intent=global&limit=5&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&v=20160828'
To diagnose the issue, it might make sense to try and simulate both inputs e.g. near and query params using curl above to diagnose whether the response is what you are looking for.
In addition it's worthwhile noting that near
must be a string representing a place in the world. If the near string is not geocodable
you should see a failed_geocode
error. Specific to your question if you use the the param near=taj%20ma
you'll likely get a failed_geocode
probably as expected. More details via https://developer.foursquare.com/docs/venues/search
For specifics on language, my understanding is that you can set the locale in the Accept-Language HTTP header in your request (preferred) or alternatively specify parameter locale
. If nothing is specified my assumption is that the language that's most popular in the country for that venue will likely be used. More details via https://developer.foursquare.com/overview/versioning
Upvotes: 1