Upload
daniel-wiegand
View
222
Download
3
Embed Size (px)
DESCRIPTION
Foursquare API insights & samples
Citation preview
FOURSQUARE API4sqCamp 2014
Corgi
Swarm
Webmontag Karlsruhe Orga
Foursquare API
PHP
opendata
Cheeseburger
SU2
FirstSquare
4sqtypecast
Frontend
ODL
agency
Karlsruhe
allesfoursquare
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
APIDefinition
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)
Foursquare APIOverview
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/)
Authentication & Connecting
__ Set up an Foursquare Account
__ Set up your APP
__ Authenticate your APP
(client ID & client secret )
__ Ready!
https://developer.foursquare.com/start
Exact the same API that both
Foursquare 8.0 and Swarm use
Versioning & Mode
Versioning
__ API versions v >= 20140806
Mode
__ API mode m = foursquare | swarm
Foursquare mode
__ venue oriented data
Swarm mode
__ user oriented data
Internationalization
HTTP header
__ Accept Language
Locale parameter
__ API locale locale = en (default) | de | es | ...
HTTP header specification is preferred
Response
Status Codes
__ Foursquare attempts to use appropriate
HTTP status codes
For example
__ 200 = OK
__ 401 = Unauthorized
__ 500 = Internal Server Error
Usage RulesWe 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 ourpolicy as “you can do basically what you want, except...”
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)
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
Venues APIpublic access - without requiring end user authentication
4sqEmojiSearch
http://www.redcouchcoding.com/playground/4sq-emoticon.php
4sqEmojiSearch
http://www.redcouchcoding.com/playground/4sq-emoticon.php
4sqEmojiSearch
http://www.redcouchcoding.com/playground/4sq-emoticon.php
4sqBarometerFoursquare API data & offline usage
Allesfoursquare.de Sample
http://allesfoursquare.de/anfang-war-die-venue-erste-gehversuche-mit-der-
foursquare-venue-api/
Facebook APP Deutsche Bahn
https://apps.facebook.com/dbfoursquare
FB-App für @DB_Bahn by @raysono (Ray Sono)
Facebook APP Deutsche Bahn
https://apps.facebook.com/dbfoursquare
FB-App für @DB_Bahn by @raysono (Ray Sono)
Facebook APP Deutsche Bahn
https://apps.facebook.com/dbfoursquare
FB-App für @DB_Bahn by @raysono (Ray Sono)
Endpoints
__ venues
__categories
__explore
__search
__suggestcompletion
__trending
Aspects: events, hours, likes, links, listed, menu,
nextvenues, photos, tips
Endpoints
__ specials
__ search
__ tips
Aspects: likes, listed & saves
__ lists
Aspects: followers & saves
Standard APIprivate access - users need to authorize your application to
access their sensitive data
4sqtypecast
http://4sq-typecast.redcouchcoding.com/
4sqtypecast
http://4sq-typecast.redcouchcoding.com/
4sqtypecast
http://4sq-typecast.redcouchcoding.com/
4sqtypecast
http://4sq-typecast.redcouchcoding.com/
Telescope | Little city guides
http://www.telescopecards.com/
Telescope | Little city guides
http://www.telescopecards.com/
Telescope | Little city guides
http://www.telescopecards.com/
Foodspotting
http://www.foodspotting.com/ - „check-in with a photo“
Foodspotting
http://www.foodspotting.com/ - „check-in with a photo“
Jet Lovers
http://www.jetlovers.com/
Jet Lovers
http://www.jetlovers.com/
Endpoints
__ users
__requests
__search
Aspects: checkins, friends, lists, mayorships
Photos, tastes, tips, venuehistory, venuelikes
__ venues
__categories
__explore
see public access
Endpoints
__ venuegroups
__ checkins
__ tips
__ lists
__ updates
__ photos
__ settings
__ specials
__ events
__ pages
__ pageupdates
__ multi (up to 5 multiple requests)
Questions. Answers.
Discussion.
Thank you!Daniel Wiegand
@wiegimania