How to use categoryId in Foursquare Object Search API

I get unexpected results from API requests when I include the categoryId parameter.

For example, when using the following parameters to search for “Public Citizen House” in Boston, MA

ll: 42.3489027315987, -71.096134185791 query: citizen categoryId: 4bf58dd8d48988d116941735 <== 'bars' 

Results end, including places from other categories, such as "banks." Is there something wrong with the categoryId parameter? In the API documentation, it is marked as "experimental." Am I using it incorrectly?

FYI: I use gim quimby to interact with the four-party API through the rails application.

Thanks!!

+6
source share
3 answers

If the place you were looking for

Citizen Community House and Oyster Bar

Then you used the wrong categoryId :(
Categories have a hierarchy, and the search is performed by it.

In particular, 4bf58dd8d48988d116941735 - the category of bars
This place is a whiskey bar, category identifier: 4bf58dd8d48988d122941735

Why the banks returned, but not sure :) I'm almost sure that when searching with a query, the foursquare simulator makes the results match the query, regardless of other filters.

You should download all categories and look at the category tree to better understand which identifier to use.
Please note: you can find the category “Nightlife” 4d4b7105d754a06376d81259 that contain all the bars, since you are looking with a request, you have to find what you are looking for (you can also try experimenting with intent=match or view and radius).

+6
source

Super late, but I found that if you put the categoryId parameter immediately after ...search? , and before the authentication and version settings it works.

eg. search?categoryId=123&client_id=456&client_secret=789&v=20140828

+3
source

All four-quarter category identifiers seem to be the same. I just polled the airport and gave it my category identifier, and then did the same for the bars. Both of them had the same category identifier.

I found one other category identifier (4eb1bc533b7b2c5b1d4306cb Airport Lounge), and when using it as a filter, it returned only results with this identifier.

0
source

Source: https://habr.com/ru/post/903851/


All Articles