+ All Categories
Home > Business > Etech2005

Etech2005

Date post: 16-Apr-2017
Category:
Upload: royans
View: 767 times
Download: 0 times
Share this document with a friend
22
Web Services Mash-up : Flickr Cal Henderson <[email protected]> O’Reilly Emerging Technology Conference March 14-17, 2005
Transcript
Page 1: Etech2005

Web Services Mash-up : Flickr

Cal Henderson <[email protected]>

O’Reilly Emerging Technology ConferenceMarch 14-17, 2005

Page 2: Etech2005

What’s Flickr?

• A website – flickr.com• A photo-sharing application• The centre of a big distributed system• An open set of APIs

– flickr.com/services/

Page 3: Etech2005

Web services?

• What the heck are web services?• The future of the Interwebnet!!!1• Web 2.0• An ‘emerging technology’

– (no, really)

Page 4: Etech2005

But seriously?

• Probably a service accessed over the web

• RSS/Atom/RDF Feeds• The Flickr API• (Also, Flickr-specific junk)

Page 5: Etech2005

Logical Architecture

Page Logic

Business/Application Logic

DatabasePhoto Storage

API Logic

EndpointsTemplates

Users

3rd Party Apps Flickr Apps

Node Service

Flickr.comEmail

Parser

Page 6: Etech2005

Logical Architecture

Page Logic

Business/Application Logic

DatabasePhoto Storage

API Logic

EndpointsTemplates

Users

3rd Party Apps Flickr Apps

Node Service

Flickr.comEmail

Parser

Page 7: Etech2005

API Architecture

Endpoints

Users

Applications

HTTP Transport

Net / Local Transport

Page 8: Etech2005

Transport Voodoo

• Like any decent Internet ‘standard’, there’s more than one

• A quick guide to the trendy ones…

Page 9: Etech2005

SOAP

• Simple Object Access Protocol• Now just SOAP

– (not so simple anymore)• Google uses it

Page 10: Etech2005

SOAP Response

<s:Envelopexmlns:s=http://www.w3.org/2003/05/soap-envelope

xmlns:xsi=http://www.w3.org/1999/XMLSchema-instancexmlns:xsd=http://www.w3.org/1999/XMLSchema

><s:Body>

<x:FlickrResponse xmlns:x="urn:flickr">[escaped-xml-payload]

</x:FlickrResponse></s:Body>

</s:Envelope>

Page 11: Etech2005

XML-RPC

• XML Remote Procedure Call• Used by the blogging APIs• Created by Dave Winer in 1998

– Because SOAP was taking a long time

Page 12: Etech2005

XML-RPC Response

<methodResponse><params>

<param><value>

<string>[escaped-xml-payload]

</string></value>

</param></params>

</methodResponse>

Page 13: Etech2005

REST

• Representational State Transfer– Crazy name

• Thanks Roy Fielding at Apache

• It’s really simple– Just XML over HTTP– (Though purists say it’s only HTTP GET)

Page 14: Etech2005

REST Response

<rsp stat="ok">[xml-payload]

</rsp>

Page 15: Etech2005

Page Scraping

• Been around for ever• HTML-over-HTTP• Volatile interface• Makes site owners angry

Page 16: Etech2005

Scrumjax

• Probably the future

Page 17: Etech2005

Offering Web Services

• Be transport agnostic– Some people love SOAP, some love REST– Make them all (somewhat) happy

• Beware of ‘shitty coders’

Page 18: Etech2005

Performance Problems

• People can scrape your site and pull a lot of pages in a short time

• This is bad• But API abuse (even accidental) can be

a lot worse

Page 19: Etech2005

An example

• Someone writes a trendy screensaver app for Flickr which shows recent photos.

• It checks for new photos every 2 seconds

• A bunch of people download it

Page 20: Etech2005

Danger!

• With 100 users, that’s 50 hits per second

• If it’s making a particularly taxing database call, it’s going to cause problems

Page 21: Etech2005

Possible solutions

• Incorporate caching into API bindings• Enforced policy

– Through API keys, etc.• Cache at the host application level• Monitor things closely

Page 22: Etech2005