Einführung in die @4sqapi

46
FOURSQUARE API 4sqCamp 2014

description

Foursquare API insights & samples

Transcript of Einführung in die @4sqapi

Page 1: Einführung in die @4sqapi

FOURSQUARE API4sqCamp 2014

Page 2: Einführung in die @4sqapi

Corgi

Swarm

Webmontag Karlsruhe Orga

Foursquare API

PHP

opendata

Cheeseburger

SU2

FirstSquare

4sqtypecast

Frontend

ODL

agency

Karlsruhe

allesfoursquare

Page 3: Einführung in die @4sqapi

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

Page 4: Einführung in die @4sqapi

APIDefinition

Page 5: Einführung in die @4sqapi

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)

Page 6: Einführung in die @4sqapi

Foursquare APIOverview

Page 7: Einführung in die @4sqapi

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/)

Page 8: Einführung in die @4sqapi

Authentication & Connecting

__ Set up an Foursquare Account

__ Set up your APP

__ Authenticate your APP

(client ID & client secret )

__ Ready!

https://developer.foursquare.com/start

Page 9: Einführung in die @4sqapi

Exact the same API that both

Foursquare 8.0 and Swarm use

Page 10: Einführung in die @4sqapi

Versioning & Mode

Versioning

__ API versions v >= 20140806

Mode

__ API mode m = foursquare | swarm

Foursquare mode

__ venue oriented data

Swarm mode

__ user oriented data

Page 11: Einführung in die @4sqapi

Internationalization

HTTP header

__ Accept Language

Locale parameter

__ API locale locale = en (default) | de | es | ...

HTTP header specification is preferred

Page 12: Einführung in die @4sqapi

Response

Status Codes

__ Foursquare attempts to use appropriate

HTTP status codes

For example

__ 200 = OK

__ 401 = Unauthorized

__ 500 = Internal Server Error

Page 13: Einführung in die @4sqapi

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...”

Page 14: Einführung in die @4sqapi

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)

Page 15: Einführung in die @4sqapi

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

Page 16: Einführung in die @4sqapi

Venues APIpublic access - without requiring end user authentication

Page 17: Einführung in die @4sqapi

4sqEmojiSearch

http://www.redcouchcoding.com/playground/4sq-emoticon.php

Page 18: Einführung in die @4sqapi

4sqEmojiSearch

http://www.redcouchcoding.com/playground/4sq-emoticon.php

Page 19: Einführung in die @4sqapi

4sqEmojiSearch

http://www.redcouchcoding.com/playground/4sq-emoticon.php

Page 20: Einführung in die @4sqapi

4sqBarometerFoursquare API data & offline usage

Page 21: Einführung in die @4sqapi
Page 22: Einführung in die @4sqapi

Allesfoursquare.de Sample

http://allesfoursquare.de/anfang-war-die-venue-erste-gehversuche-mit-der-

foursquare-venue-api/

Page 23: Einführung in die @4sqapi

Facebook APP Deutsche Bahn

https://apps.facebook.com/dbfoursquare

FB-App für @DB_Bahn by @raysono (Ray Sono)

Page 24: Einführung in die @4sqapi

Facebook APP Deutsche Bahn

https://apps.facebook.com/dbfoursquare

FB-App für @DB_Bahn by @raysono (Ray Sono)

Page 25: Einführung in die @4sqapi

Facebook APP Deutsche Bahn

https://apps.facebook.com/dbfoursquare

FB-App für @DB_Bahn by @raysono (Ray Sono)

Page 26: Einführung in die @4sqapi

Endpoints

__ venues

__categories

__explore

__search

__suggestcompletion

__trending

Aspects: events, hours, likes, links, listed, menu,

nextvenues, photos, tips

Page 27: Einführung in die @4sqapi

Endpoints

__ specials

__ search

__ tips

Aspects: likes, listed & saves

__ lists

Aspects: followers & saves

Page 28: Einführung in die @4sqapi

Standard APIprivate access - users need to authorize your application to

access their sensitive data

Page 29: Einführung in die @4sqapi
Page 30: Einführung in die @4sqapi

4sqtypecast

http://4sq-typecast.redcouchcoding.com/

Page 31: Einführung in die @4sqapi

4sqtypecast

http://4sq-typecast.redcouchcoding.com/

Page 32: Einführung in die @4sqapi

4sqtypecast

http://4sq-typecast.redcouchcoding.com/

Page 33: Einführung in die @4sqapi

4sqtypecast

http://4sq-typecast.redcouchcoding.com/

Page 34: Einführung in die @4sqapi
Page 35: Einführung in die @4sqapi

Telescope | Little city guides

http://www.telescopecards.com/

Page 36: Einführung in die @4sqapi

Telescope | Little city guides

http://www.telescopecards.com/

Page 37: Einführung in die @4sqapi

Telescope | Little city guides

http://www.telescopecards.com/

Page 38: Einführung in die @4sqapi
Page 39: Einführung in die @4sqapi

Foodspotting

http://www.foodspotting.com/ - „check-in with a photo“

Page 40: Einführung in die @4sqapi

Foodspotting

http://www.foodspotting.com/ - „check-in with a photo“

Page 41: Einführung in die @4sqapi

Jet Lovers

http://www.jetlovers.com/

Page 42: Einführung in die @4sqapi

Jet Lovers

http://www.jetlovers.com/

Page 43: Einführung in die @4sqapi

Endpoints

__ users

__requests

__search

Aspects: checkins, friends, lists, mayorships

Photos, tastes, tips, venuehistory, venuelikes

__ venues

__categories

__explore

see public access

Page 44: Einführung in die @4sqapi

Endpoints

__ venuegroups

__ checkins

__ tips

__ lists

__ updates

__ photos

__ settings

__ specials

__ events

__ pages

__ pageupdates

__ multi (up to 5 multiple requests)

Page 45: Einführung in die @4sqapi

Questions. Answers.

Discussion.

Page 46: Einführung in die @4sqapi

Thank you!Daniel Wiegand

@wiegimania