proseminar web engineering ps07: retrieving data from social networks: apis and protocols

34
Proseminar Web Engineering PS07: Retrieving data from social networks: APIs and protocols

Upload: vadin

Post on 08-Jan-2016

30 views

Category:

Documents


4 download

DESCRIPTION

Proseminar Web Engineering PS07: Retrieving data from social networks: APIs and protocols. Wir wollen Daten aus. sozialen Netzwerken. Quelle: http://www.flickr.co m/photos/theplanetdotcom/4878805271. Wir brauchen Schnittstellen. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Proseminar Web Engineering

PS07: Retrieving data fromsocial networks: APIs and protocols

Page 2: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Wir wollen Daten aus

Quelle: http://www.flickr.com/photos/theplanetdotcom/4878805271

sozialen Netzwerken.

Page 3: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Wir brauchen Schnittstellen.

Quelle: http://www.flickr.com/photos/78317189@N00/2106395842

Page 4: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

(1993) "Application program interface„

"Schnittstelle für Anwendungsprogramme".

Die Nutzung von APIs erlaubt es

Softwareentwicklern, Anwendungen zu schreiben

und dabei bereits vorhandene, standardisierte

Bibliotheksroutinen zu nutzen.

APIs

Quelle: http://lexikon.martinvogel.de/api.html

Page 5: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

APIs sind Designprobleme

Quelle: http://www.dastimmtdochwasnicht.de/MyUploads/071221_Ziehen.jpg

Page 6: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

SOAP vs REST

Page 7: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Seife?

Quelle: http://www.flickr.com/photos/annia316/4492308897

Simple Object Access Protocol

Page 8: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

SOAP

• Protokoll mit Regeln für Nachrichtendesign• Konvention für entfernte Prozeduraufrufe• Nutzt Netzwerkprotokolle auf Transport- und

Anwendungsschicht (HTTP(S), SMTP)• Nutzt XML zur Repräsentation• Unterstützung von z.B. IBM, Microsoft

Page 9: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

SOAP – Aufbau Request

<?xml version="1.0"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> <s:Header> </s:Header> <s:Body> <m:UserInDatabase xmlns:m="http://www.socialnetwork-db.de/soap"> meinUsername </m:UserInDatabase> </s:Body></s:Envelope>

Page 10: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

SOAP – Aufbau Response<?xml version="1.0"?><s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"> <s:Header> <m:RequestID xmlns:m="http://www.socialnetwork-db.de/soap"> a3f5c109b </m:RequestID> </s:Header> <s:Body> <m:DbResponse xmlns:m="http://www.socialnetwork-db.de/soap"> <m:user>

<!-- Infos zum User --> </m:user> </m:DbResponse> </s:Body></s:Envelope>

Page 11: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

SOAP vs REST

Page 12: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

to rest = ausruhen?

Quelle: http://bit.ly/tig2b7

Representational State Transfer

Page 13: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

REST

• Web-Paradigma, aber keine Norm• Interaktionen sind zustandslos• Caching möglich• Repräsentation von Ressourcen• Baut auf HTTP auf

Page 14: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

HTTP

POSTGETPUTDELETE

CRUD

CREATEREADUPDATEDELETE

SQL

INSERTSELECTUPDATEDELETE

Page 15: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Status – GET, POST, DELETE

User – GET, POST, PUT, DELETE

Like – GET, POST, DELETE

Page 16: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Quelle: https://farm1.static.flickr.com/194/503716476_6f08285ac3_o.png

Page 17: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Alexa-Rank: 2

800 Mio. aktive Nutzer

Page 18: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Alexa-Rank: 9

100 Mio. aktive Nutzer

Page 19: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Alexa-Rank: 13

Mehr als 135 Mio. Nutzer

Page 20: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

50 Mio. Nutzer

Page 21: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Zugriff auf Daten per…

Graph API (Facebooks REST API)

REST API (, Streaming API, Search API)

REST API

REST API (noch in Entwicklung)

Page 22: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Wo SOAP genutzt wird:• Flickr (neben REST-API)• eBay Powerseller• Amazon (neben REST-API)• Google Search API bis 2009 (eingestellt)

Page 23: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

https://graph.facebook.com

GET /{userid}/

GET /{userid}/feed

GET /{statusid}

GET /{statusid}/likes

POST /{statusid}/likes

DELETE /{statusid}/likes

Beispiele

Page 24: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

https://api.twitter.com/1

GET /users/lookup.json?screen_name={name}

GET /statuses/public_timeline.xml

POST /statuses/update

POST /statuses/destroy/{tweet-id}

GET /users/profile_image/{twitter-username}

Beispiele

Page 25: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Quelle: http://www.readwriteweb.com/hack/2011/07/twitter-serves-more-api-calls.php

Page 26: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Quelle: http://www.flickr.com/photos/vgm8383/2191223539

Viele Nutzer + viele Daten= viel Traffic

Page 27: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Rate-Limits:

Je Applikation 600 Anfragen in 600 sec

Je IP 150/h oder je Benutzer 350/h

Netzwerk-Updates: 300/h je Benutzer

Je Entwickler 1000 pro Tag

Page 28: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Pagination:

offset, limit / until, since /

paging.next, paging.previous

page, rpp (return per page) / max_id

start, count

maxResults, nextPageToken

Page 29: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Daten in Echtzeit bekommen

Quelle: http://www.flickr.com/photos/brandoncwarren/4334456172

Page 30: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Twitter Streaming API Response

HTTP/1.1 200 OKContent-Type: application/jsonTransfer-Encoding: chunkedServer: Jetty(6.1.25)

{…}{…}{…}

Page 31: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

It‘s demo time

Quelle: http://www.etuc.org/IMG/jpg/2000-Euromanif_Porto02-2.jpg

Page 32: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

SOAP vs REST

Page 33: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Fazit• REST bietet Caching• REST ist skalierbarer• REST lässt sich mit HTTP einfach in Anwendungen

oder Webseiten einbinden• SOAP zustandsorientiert, REST zustandslos• REST verursacht weniger Daten-Traffic• SOAP bietet mehr Zuverlässlichkeit bei der

Übertragung• Mit REST ist die Sicherheit in Webanwendungen

einfacher kontrollierbar

Page 34: Proseminar Web Engineering PS07:  Retrieving  data from social networks: APIs and protocols

Vielen Dank für die Aufmerksamkeit!

POST /questionGET /answer