3. Agenda
API definition
__ API & Foursquare API
Foursquare API insights
__ setup, connect, response & usage rules
Venues API
__ samples without user authentification
Standard API
__ samples with user authentification
5. API Definition
In computer programming, an application
programming interface (API) is a set of routines,
protocols, and tools for building software
applications. An API expresses a software
component in terms of its operations, inputs,
outputs, and underlying types. [...] A good API
makes it easier to develop a program by providing
all the building blocks. A programmer then puts
the blocks together.
Source: Wikipedia (http://en.wikipedia.org/wiki/Application_programming_interface)
7. Foursquare API
The Foursquare API gives you access to our
world-class places database and the ability to
interact with Foursquare users and merchants.
Start using the only location API you'll ever need.
Source: Foursquare (https://developer.foursquare.com/)
8. Authentication & Connecting
__ Set up an Foursquare Account
__ Set up your APP
__ Authenticate your APP
(client ID & client secret )
__ Ready!
https://developer.foursquare.com/start
9. Exact the same API that both
Foursquare 8.0 and Swarm use
10. Versioning & Mode
Versioning
__ API versions v >= 20140806
Mode
__ API mode m = foursquare | swarm
Foursquare mode
__ venue oriented data
Swarm mode
__ user oriented data
11. Internationalization
HTTP header
__ Accept Language
Locale parameter
__ API locale locale = en (default) | de | es | ...
HTTP header specification is preferred
12. Response
Status Codes
__ Foursquare attempts to use appropriate
HTTP status codes
For example
__ 200 = OK
__ 401 = Unauthorized
__ 500 = Internal Server Error
13. Usage Rules
We love it when people use Foursquare as their location database, but
there are some basic rules everyone has to follow. We like to think of our
policy as “you can do basically what you want, except...”
14. Usage Rules
__ free to use
__ provide proper attribution
__ allowed to cache as long as it is
refreshed appropriately
__ display Foursquare location data with
other information (attribute the data
that’s from Foursquare)
15. Usage Rules
__ scraping is allowed if it is less than
1,000 calls
__ prevent needless API calls! (prefetching)
__ don‘t show more than 4 tips/photos from
the same venue simultaneously
__ sell, rent or transfer
16. Venues API
public access - without requiring end user authentication