问题描述
包括类别参数时,我会从API查询中获得意外的结果.
例如,在使用以下参数搜索马萨诸塞州波士顿的"公民公共房屋"时
ll: 42.3489027315987, -71.096134185791 query: citizen categoryId: 4bf58dd8d48988d116941735 <== 'bars'
结果最终包括其他类别的场所,例如"银行".类别参数有问题吗?在API文档中,它被标记为"实验".我是否不正确地使用它?
fyi:我正在使用Quimby Gem通过Rails App与Foursquare API接口.
谢谢!
推荐答案
如果您要寻找的地方
公民公共房屋和牡蛎酒吧
然后您使用了错误的类别:(
该类别具有层次结构,搜索是由此完成的.
特别是,4bf58dd8d48988d116941735是条类别
那个地方是威士忌吧,类别ID:4bf58dd8d48988d122941735
为什么银行返回,不确定:)我几乎确定在使用查询搜索时,foursquare Engine Force将与查询相匹配,无论其他过滤器如何.
其他推荐答案
超级晚,但是我发现,如果您直接在...search?之后放置categoryId参数,并且在您的身份验证和版本参数之前,它可以正常工作.
search?categoryId=123&client_id=456&client_secret=789&v=20140828
其他推荐答案
似乎所有类别的foursquare都相同.我刚刚投入了一次机场的调查,让它给我类别ID,然后在酒吧做同样的事情.他们都有相同的类别.
我找到了一个不同的类别ID(4EB1BC533B7B2C5B1D4306CB机场休息室),当将其用作滤镜时,它仅带有此ID返回结果.
问题描述
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
Citizen Public House & Oyster Bar
Then you were using the wrong categoryId :(
The categories have an hierarchy, and search is done by it.
Specifically, 4bf58dd8d48988d116941735 is the bars category
That 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 with intent=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.