Mike Z
Mike Z

Reputation: 4111

Foursquare API Categories

I must be misunderstanding categories on the foursquare API and it is driving me crazy.

When I send this:

 https://api.foursquare.com/v2/venues/search?ll=44.874491,-93.328212&client_id=XXX&client_secret=XXX&v=20130327

I get all the venues as I would expect. However, if I do the categoryId for coffee shops as so:

 https://api.foursquare.com/v2/venues/search?ll=44.874491,-93.328212&categoryId=4bf58dd8d48988d1e0931735&client_id=XXX&client_secret=XXX&v=20130327

I lose the closest coffee shops that originally showed up. In particular, the one I'm sitting in with address of 7101 France Ave S. This behavior has been consistently odd.

And then a second question: since Coffee Shop is a category below Food, should I not get them when I limit to Food category? If I do that:

 https://api.foursquare.com/v2/venues/search?ll=44.874491,-93.328212&categoryId=4d4b7105d754a06374d81259&client_id=XXX&client_secret=XXX&v=20130327

I do not get a single coffee shop. This is driving me crazy and I know I must be missing something simple. Thanks in advance!

Upvotes: 0

Views: 1183

Answers (1)

octopi
octopi

Reputation: 2004

As specified in the Foursquare docs on venues/search, you should specify a radius parameter when using categoryId. Doing so with your search seems to return better results.

"Food" is a broad category and perhaps the results you are seeing are "better" matches for various reasons (popularity, proximity, etc.) Again, you should be specifying a radius when using categoryId. You ought to also look over the different intents available for venues/search to find out which one is best for your app! It may help if you start using this param as well.

Upvotes: 3

Related Questions