Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i search places with specific type

Tags:

foursquare

I am using Foursquare API to get the nearest locations for my current location. Can anyone please guide me how I can get the nearest places of a specific type? (I mean I need all gas stations, cafes, etc. near me).

Here is the link I am using https://api.foursquare.com/v2/venues/search?ll=41.104805,29.024291&oauth_token=EDO2GW34NJ5QBUVL5YXQTDYK41X2QMFBHS1XCY1FZMJFWNVM&v=20111229

Here I get some locations but I am unable to find gas stations or cafes so please guide me how can I get those specific places near by me.

Thanks in advance.

like image 954
Chithri Ajay Avatar asked Feb 02 '26 22:02

Chithri Ajay


1 Answers

The search parameter documentation is here: https://developer.foursquare.com/docs/venues/search

You can make an API call to get the categories. The doc is here: https://developer.foursquare.com/docs/venues/categories

The actual call is: https://api.foursquare.com/v2/venues/categories

And it returns all the categories - you need to parse through this json return object to find what you're looking for.

Once you've got your category (in this case let's use Gas Stations), you can add category to the query you already had: https://api.foursquare.com/v2/venues/search?categoryId=4bf58dd8d48988d113951735&ll=41.104805,29.024291&oauth_token=EDO2GW34NJ5QBUVL5YXQTDYK41X2QMFBHS1XCY1FZMJFWNVM&v=20111229

like image 157
Kirsten Jones Avatar answered Feb 04 '26 15:02

Kirsten Jones