FourSquare Venues API
Asked Answered
Z

3

5

I am a bit shaky on how to use the venues API in forusquare. My main question is related to OAuth. I want to be able to do venue searches on the server side of the system, and i need the server to login into foursquare automatically. It says on the website that foursquare doesn't require user authentication to use some of the venue functions, however whenever i try to do a call to: venues/categories without specifying an oath_token I get a permission error.

How can i do venue calls without having to use a user login?

Thanks in advance.

Zeldazelde answered 17/12, 2011 at 20:40 Comment(0)
C
7

It would help if you had given the exact url you are trying to call, but in general:

The userless requests to Foursquare still require the client id and client secret that you get when you register the OAuth Consumer in foursquare.

Using the id + secret you can access Venue API endpoints without authenticating with a user.

So if I got to the Venues Categories endpoint you can see that it does not require and acting user and thus accessing:

https://api.foursquare.com/v2/venues/categories?client_id={0}&client_secret={1}&v={2}

Will get the categories list.
In that example, replace {0} with your client id, {1} with your client secret and {2} with whatever version date you feel comfortable with, today would be 20111218

More can be found here https://developer.foursquare.com/overview/auth#userless

Cabinetmaker answered 18/12, 2011 at 11:23 Comment(0)
C
2

you can use https://developer.foursquare.com/docs/explore#req=/venues/categories and in the view box use /venues/categories to see a list of all of the venue codes to use. then simply use:

https://api.foursquare.com/v2/venues/search?ll="+ ll+"&radius=10000&limit=50&categoryId="+catID+"&client_secret=xxx&client_id=xxx

in your call to load the url based upon ll which is long and lat and it will create a response of json object to parse. The App/Web site does not need to be authorized for such a search, and the limit goes to 5000 calls per hour, and you can increase this by emailing Foursquare with the application information and screen image of the app showing you credit Foursquare with the info, like a Foursquare button, etc. - Hope this helps.

Cosentino answered 16/2, 2012 at 13:7 Comment(0)
D
1

Visit https://foursquare.com/developers/apps to get your API keys. Once you click "Create A New App", your Client ID and Client Secret should be visible.

Once you have your keys, try plugging them into this search:

https://api.foursquare.com/v2/venues/search?near=seattle,wa&query=coffee&v=20150214&m=foursquare&client_secret=xxx&client_id=xxx

Dandridge answered 18/2, 2015 at 22:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.