FourSquare Venues API

user1103881 picture user1103881 · Dec 17, 2011 · Viewed 10.3k times · Source

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.

Answer

Jonathan Levison picture Jonathan Levison · Dec 18, 2011

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