当前位置: 动力学知识库 > 问答 > 编程问答 >

http - 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!

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: