It is supposed to be
https://api.foursquare.com/v2/venues/search?ll=40.7484,-73.9857&categoryId=4d4b7105d754a06374d81259&radius=100&limit=5&client_id=X&client_secret=X&v=20200101
4d4b7105d754a06374d81259 is the categoryId
for Food.
So, I expect to get a list of venues with that category.
But I am getting venues of every kind.
Sample-
{
"meta": {
"code": 200
"requestId": "5f0d9ac6a0a468438f4f1b11"
}
"notifications": [
{
"type": "notificationTray"
"item": {
"unreadCount": 0
}
}
]
"response": {
"venues": [
{
"id": "43695300f964a5208c291fe3"
"name": "Empire State Building"
"contact": {
"phone": "+12127363100"
"formattedPhone": "+1 212-736-3100"
"twitter": "empirestatebldg"
"instagram": "empirestatebldg"
"facebook": "153817204635459"
"facebookUsername": "empirestatebuilding"
"facebookName": "Empire State Building"
}
"location": {
"address": "350 5th Ave"
"crossStreet": "btwn 33rd & 34th St"
"lat": 40.7485995507123
"lng": -73.98580648682452
"distance": 23
"postalCode": "10118"
"cc": "US"
"neighborhood": "Midtown Manhattan, New York, NY"
"city": "New York"
"state": "NY"
"country": "United States"
"formattedAddress": [
"0": "350 5th Ave (btwn 33rd & 34th St)"
"1": "New York, NY 10118"
"2": "United States"
]
}
"categories": [
"0": {
"id": "4bf58dd8d48988d130941735"
"name": "Building" # SEE HERE, ITS A BUILDING
"pluralName": "Buildings"
"shortName": "Building"
"icon": {
"prefix": "https://ss3.4sqi.net/img/categories_v2/building/default_"
"suffix": ".png"
}
"primary": true
}
]
"verified": true
"stats": {
"tipCount": 1165
"usersCount": 140228
"checkinsCount": 202739
}
"url": "https://www.esbnyc.com"
"venueRatingBlacklisted": true
"beenHere": {
"lastCheckinExpiredAt": 0
}
"venuePage": {
"id": "64514349"
}
"storeId": ""
"hereNow": {
"count": 0
"summary": "Nobody here"
"groups": [
]
}
"referralId": "v-1594727371"
"venueChains": [
]
"hasPerk": false
}
{
"id": "4bcca12bb6c49c7422169491"
"name": "86th Floor Observation Deck"
"contact": {
"phone": "+12127363100"
"formattedPhone": "+1 212-736-3100"
}
"location": {
"address": "350 5th Ave"
"crossStreet": "btwn 33rd & 34th Sts"
"lat": 40.74844544481811
"lng": -73.98568124187432
"labeledLatLngs": [
"0": {
"label": "display"
"lat": 40.74844544481811
"lng": -73.98568124187432
}
]
"distance": 5
"postalCode": "10118"
"cc": "US"
"city": "New York"
"state": "NY"
"country": "United States"
"formattedAddress": [
"0": "350 5th Ave (btwn 33rd & 34th Sts)"
"1": "New York, NY 10118"
"2": "United States"
]
}
"categories": [
"0": {
"id": "4bf58dd8d48988d165941735"
"name": "Scenic Lookout" # LOOK HERE, IT'S SCENIC LOOKOUT
"pluralName": "Scenic Lookouts"
"shortName": "Scenic Lookout"
"icon": {
"prefix": "https://ss3.4sqi.net/img/categories_v2/parks_outdoors/sceniclookout_"
"suffix": ".png"
}
"primary": true
}
]
"verified": true
"stats": {
"tipCount": 241
"usersCount": 21820
"checkinsCount": 23730
}
"beenHere": {
"lastCheckinExpiredAt": 0
}
"venuePage": {
"id": "64514350"
}
"hereNow": {
"count": 0
"summary": "Nobody here"
"groups": [
]
}
"referralId": "v-1594727371"
"venueChains": [
]
"hasPerk": false
}
{
"id": "5af44f23bcbf7a002ce0a18a"
"name": "Workday"
"contact": {
}
"location": {
"address": "350 5th Ave"
"lat": 40.748333
"lng": -73.985577
"labeledLatLngs": [
"0": {
"label": "display"
"lat": 40.748333
"lng": -73.985577
}
]
"distance": 12
"postalCode": "10001"
"cc": "US"
"city": "New York"
"state": "NY"
"country": "United States"
"formattedAddress": [
"0": "350 5th Ave"
"1": "New York, NY 10001"
"2": "United States"
]
}
"categories": [
"0": {
"id": "4bf58dd8d48988d124941735"
"name": "Office" # IT'S AN OFFICE
"pluralName": "Offices"
"shortName": "Office"
"icon": {
"prefix": "https://ss3.4sqi.net/img/categories_v2/building/default_"
"suffix": ".png"
}
"primary": true
}
]
"verified": false
"stats": {
"tipCount": 0
"usersCount": 12
"checkinsCount": 69
}
"venueRatingBlacklisted": true
"beenHere": {
"lastCheckinExpiredAt": 0
}
"hereNow": {
"count": 0
"summary": "Nobody here"
"groups": [
]
}
"referralId": "v-1594727371"
"venueChains": [
]
"hasPerk": false
}
{
"id": "5820b92252addb0cc786c053"
"name": "Expedia - New York City Office"
"contact": {
}
"location": {
"address": "350 5th Ave"
"lat": 40.748452
"lng": -73.985595
"labeledLatLngs": [
"0": {
"label": "display"
"lat": 40.748452
"lng": -73.985595
}
]
"distance": 10
"postalCode": "10118"
"cc": "US"
"city": "New York"
"state": "NY"
"country": "United States"
"formattedAddress": [
"0": "350 5th Ave"
"1": "New York, NY 10118"
"2": "United States"
]
}
"categories": [
"0": {
"id": "4bf58dd8d48988d124941735"
"name": "Office"
"pluralName": "Offices"
"shortName": "Office"
"icon": {
"prefix": "https://ss3.4sqi.net/img/categories_v2/building/default_"
"suffix": ".png"
}
"primary": true
}
]
"verified": false
"stats": {
"tipCount": 0
"usersCount": 15
"checkinsCount": 52
}
"venueRatingBlacklisted": true
"beenHere": {
"lastCheckinExpiredAt": 0
}
"hereNow": {
"count": 0
"summary": "Nobody here"
"groups": [
]
}
"referralId": "v-1594727371"
"venueChains": [
]
"hasPerk": false
}
{
"id": "59a44ba0e97dfb37208faf41"
"name": "JCDecaux, NA"
"contact": {
}
"location": {
"address": "350 Fifth Avenue, 73rd floor"
"lat": 40.74847232935598
"lng": -73.98566846513467
"labeledLatLngs": [
"0": {
"label": "display"
"lat": 40.74847232935598
"lng": -73.98566846513467
}
]
"distance": 8
"postalCode": "10001"
"cc": "US"
"city": "New York"
"state": "NY"
"country": "United States"
"formattedAddress": [
"0": "350 Fifth Avenue, 73rd floor"
"1": "New York, NY 10001"
"2": "United States"
]
}
"categories": [
"0": {
"id": "4bf58dd8d48988d124941735"
"name": "Office"
"pluralName": "Offices"
"shortName": "Office"
"icon": {
"prefix": "https://ss3.4sqi.net/img/categories_v2/building/default_"
"suffix": ".png"
}
"primary": true
}
]
"verified": false
"stats": {
"tipCount": 0
"usersCount": 21
"checkinsCount": 452
}
"venueRatingBlacklisted": true
"beenHere": {
"lastCheckinExpiredAt": 0
}
"hereNow": {
"count": 0
"summary": "Nobody here"
"groups": [
]
}
"referralId": "v-1594727371"
"venueChains": [
]
"hasPerk": false
}
]
"confident": false
}
}
So, what exactly am I doing wrong? What should be done to get only those venues in response which has their category as Food or some subcategory of it?
Your parameter is wrong. Replace categoryID
with categoryId
.
https://api.foursquare.com/v2/venues/search?ll=40.7484,-73.9857&categoryID=4d4b7105d754a06374d81259&radius=100&limit=5&client_id=X&client_secret=X&v=20200101
->
https://api.foursquare.com/v2/venues/search?ll=40.7484,-73.9857&categoryId=4d4b7105d754a06374d81259&radius=100&limit=5&client_id=X&client_secret=X&v=20200101