I am getting unexpected results from API queries when including a categoryId parameter.
For instance, when using the following parameters to search for 'The Citizen Public House' in Boston, MA
ll: 42.3489027315987, -71.096134185791
query: citizen
categoryId: 4bf58dd8d48988d116941735 <== 'bars'
The results wind up including venues from other categories, like 'banks'. Is there something wrong with the categoryId parameter? In the API documentation it is labeled 'experimental.' Am I using it improperly?
FYI: I am using the quimby gem to interface with the foursquare API via a rails app.
Thanks!!
If the place you were looking for is
Then you were using the wrong categoryId :(
The categories have an hierarchy, and search is done by it.
Specifically,
4bf58dd8d48988d116941735
is the bars categoryThat place is a Whisky Bar, category ID:
4bf58dd8d48988d122941735
Why banks returned, not sure :) I am almost sure that when searching with a query, the foursquare engine forces results to match the query, regardless of other filters.
You should download all categories and see the categories tree to better understand which ID to use.
Note, you can look for the Nightlife category
4d4b7105d754a06376d81259
which have all bars included in it, since you are looking with a query you should find what you are looking for (you can also try experimenting withintent=match
or browse and a radius as well).Super late, but i found that if you put the
categoryId
parameter directly after...search?
and before your authentication and version parameters, it works.eg.
search?categoryId=123&client_id=456&client_secret=789&v=20140828
It seems that all the categoryIDs at foursquare are the same. I just polled for an airport and let it give me its categoryID and then did the same for bars. They both had the same categoryID.
I found one different categoryID (4eb1bc533b7b2c5b1d4306cb Airport Lounge) and when using it as a filter it returned only results with this ID.