SlideShare uma empresa Scribd logo
1 de 31
The Internet as Web Services: introduction to ReST
Oscar Zambotti is a student of Information Technology at the Faculty of Science, University of Trento. He attended the 9-months course "ICT secure programming expert" in Bozen offered by the European Social Fund. Now he's in FBK for his stage period in the SoNet Group and following the “ Presentation or die ” motto is giving this presentation in the very beginning of his stage. Oscar is very interested in social networking and programming applications about it. He is also a speaker and DJ in a local radio station. http://www.oskarnrk.net [email_address] Bio “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
[object Object]
Different ways: SOAP and ReST
Examples: Twitter and Flickr
How am I going to use ReST? What am I going to talk about? “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
1.  What is a Web Service?
“ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 “ The challenge now is to join forces to research on Software & Services Technologies, to bring advances to the market and to ensure European leadership in the new Internet economy: The Internet of Services.” Internet of Services, Software and Virtualisation  -  Objective ICT 2009.1.2, Call 5 of the  Seventh Framework Programme (2007-2013) European Commission - Information Society and Media “ The Internet has shown remarkable resilience and flexibility in the face of ever increasing numbers of users, data volume, and changing usage patterns, but faces growing challenges in meetings the needs of our knowledge society. This is the moment to start designing the Internet of the Future.” Future Internet  - Research programs of the CIT (Center for Innovation Technology) Fondazione Bruno Kessler The vision of the “Future Internet”
“ A  Web Service  (WS) is a software system designed to support  interoperable machine-to-machine  interaction over a network.”  - W3C Glossary Usually a WS provides the  API  ( Application Programming Interface ). ,[object Object]
Languages limitations?
Access limitations? What is a web service? “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
Use of web services? E.g. Flickrvision “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 Flickr photos with Google Maps
A  mashup  is a Web application that combines  data  or  functionality  from one or more sources into a single integrated application. http://www.programmableweb.com “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 Web services for mashups
“ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 ProgrammableWeb statistics 1308 APIs 3957 Mashups (12 May 2009) The trend...
2.  Different ways: SOAP and ReST
SOAP  ( Simple Object Access Protocol ) uses  XML  and  RPC  or  HTTP . Businesses can register their WS on  UDDI ( Universal Description, Discovery and Integration ) and provide documentation with  WSDL ( Web Services Description Language ) “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 image: Wikipedia How to use a web service: SOAP image: Wikipedia
<soapenv:Envelope   xmlns:soapenv=&quot; http://schemas.xmlsoap.org/soap/envelope/ &quot;   xmlns:xsd=&quot; http://www.w3.org/2001/XMLSchema &quot;   xmlns:xsi=&quot; http://www.w3.org/2001/XMLSchema-instance &quot;>   <soapenv:Body>   <req:echo xmlns:req=&quot; http://localhost:8080/axis2/services/MyService/ &quot;>   <req:category>classifieds</req:category>   </req:echo>   </soapenv:Body> </soapenv:Envelope> “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 How to use a web service: SOAP /2 Sample: Request...
<soapenv:Envelope   xmlns:soapenv=&quot; http://schemas.xmlsoap.org/soap/envelope/ &quot;   xmlns:wsa=&quot; http://schemas.xmlsoap.org/ws/2004/08/addressing &quot;>   <soapenv:Header>   <wsa:ReplyTo>   <wsa:Address>   http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous   </wsa:Address>   </wsa:ReplyTo>   <wsa:From>   <wsa:Address>   http://localhost:8080/axis2/services/MyService   </wsa:Address>   </wsa:From>   <wsa:MessageID>   ECE5B3F187F29D28BC11433905662036   </wsa:MessageID>   </soapenv:Header>   <soapenv:Body>   <req:echo xmlns:req=&quot; http://localhost:8080/axis2/services/MyService/ &quot;>   <req:category>classifieds</req:category>   </req:echo>   </soapenv:Body> </soapenv:Envelope> “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 How to use a web service: SOAP /3 ...Response
ReST  ( Representational State Transfer ) is an architectural style for distributed hypermedia systems, it is not just a method for building web services. Introduced by  Roy Thomas Fielding  in his dissertation to become Ph.D. in 2000. Resource  -> URI Interaction ->  Representation An application can interact with a resource by knowing the identifier of the resource (URI), and the action required (HTTP methods). ReST is  stateless . How to use a web service: ReST “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
HTTP consists in URIs, methods, status codes... The most important HTTP methods compose the basic functions in computer science:  CRUD How to use a web service: ReST /2 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 HTTP CRUD SQL POST Create INSERT GET Read SELECT PUT Update UPDATE DELETE Delete DELETE
http://example.com/losties How to use a web service: ReST /3 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 POST -  C reate - GET -  R ead - PUT -  U pdate - DELETE -  D elete - Create a new passenger List http://example.com/losties/4815162342 Response format: HTML, XML  (RSS, Atom, “custom”) , JSON, ... Suggested reading: “How I explained ReST to my wife” (Ryan Tomayko) POST -  C reate - GET -  R ead - PUT -  U pdate - DELETE -  D elete - Passenger data Update passenger data Delete passenger
An application is  ReSTful  when has resources accessible by representations. http://example.com/losties/4815162342 Some services are  ReST-like : you use HTTP methods but using APIs methods as parameters (Flickr). http://example.com/losties/getLostie?id=4815162342 Nouns vs Verbs How to use a web service: ReST /4 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
A large number of developers chooses ReST instead of SOAP. “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 SOAP vs. ReST on ProgrammableWeb
3.  ReST examples (Python code)
What is Twitter? Example: Twitter “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
Twitter REST API Method: statuses/show Returns a single status, specified by the id parameter below.  The status's author will be returned inline. URL: http://twitter.com/statuses/show/id.format Formats:  xml, json, rss, atom HTTP Method(s):  GET Requires Authentication: false, unless the author of the status is protected Example: Twitter /2 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 Twitter REST API Method: statuses/update Updates the authenticating user's status.  Requires the status parameter specified below.  Request must be a POST.  A status update with text identical to the authenticating user's current status will be ignored to prevent duplicates. URL: http://twitter.com/statuses/update.format Formats:  xml, json, rss, atom HTTP Method(s):  POST Requires Authentication:  true http://apiwiki.twitter.com/Twitter-API-Documentation Some methods require authentication (OAuth)
import httplib # some code... def fetch_following(self):   conn = httplib.HTTPConnection(&quot;twitter.com&quot;)   conn.request(&quot;GET&quot;,&quot;/friends/ids/&quot;+self.screen_name+&quot;.json&quot;)   r1 = conn.getresponse()   print r1.read()   conn.close() Example: Twitter /3 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 Output (sample!): user IDs [5428712,31528501,6603122,30304051,30303627,5159271, 17572031,15147484] Obj: fetch the list of the user IDs that a user is following
What is Flickr? Screenshot Example: Flickr “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
Developers need a couple of keys to use the APIs. Some methods require authentication. Example: Flickr /2 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
REST Request Format REST is the simplest request format to use - it's a simple HTTP GET or POST action. The REST Endpoint URL is   http://api.flickr.com/services/rest/ To request the flickr.test.echo service, invoke like this: http://api.flickr.com/services/rest/?method=flickr.test.echo&name=value By default, REST requests will send a REST response. Example: Flickr /3 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 http://www.flickr.com/services/api/ Some methods require authentication.
import urllib, urllib2, json FRI = &quot; http://api.flickr.com/services/rest/ ?&quot; KEY = &quot;d00fa386476950f75555555555555555&quot; SECRET = &quot;cac879e555555555&quot; FORMAT = &quot;json&quot; # some code... def people_find_by_username(username):   # some code... def contacts_get_public_list(username):   nsid = people_find_by_username(username) req = {'method': CONTACTS_GETPUBLICLIST, 'api_key': KEY,   'user_id': nsid, 'format': FORMAT, 'nojsoncallback': 1}   params = urllib.urlencode(req)   contacts_public_list =   urllib2.urlopen(FRI,params).read()   print contacts_public_list Example: Flickr /4 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 HTTP POST (implicit) Obj: fetch the list of the friends a user

Mais conteúdo relacionado

Mais procurados

REST-API overview / concepts
REST-API overview / conceptsREST-API overview / concepts
REST-API overview / conceptsPatrick Savalle
 
RESTful services
RESTful servicesRESTful services
RESTful servicesgouthamrv
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developersPatrick Savalle
 
APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...
APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...
APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...Tchelinux
 
Introduction to REST - API
Introduction to REST - APIIntroduction to REST - API
Introduction to REST - APIChetan Gadodia
 
REST API Design & Development
REST API Design & DevelopmentREST API Design & Development
REST API Design & DevelopmentAshok Pundit
 
introduction about REST API
introduction about REST APIintroduction about REST API
introduction about REST APIAmilaSilva13
 
Rest presentation
Rest  presentationRest  presentation
Rest presentationsrividhyau
 
How To Design A Good A P I And Why It Matters G O O G L E
How To Design A Good  A P I And Why It Matters    G O O G L EHow To Design A Good  A P I And Why It Matters    G O O G L E
How To Design A Good A P I And Why It Matters G O O G L Eguestbe92f4
 
REST API 설계
REST API 설계REST API 설계
REST API 설계Terry Cho
 

Mais procurados (20)

REST-API overview / concepts
REST-API overview / conceptsREST-API overview / concepts
REST-API overview / concepts
 
API Design- Best Practices
API Design-   Best PracticesAPI Design-   Best Practices
API Design- Best Practices
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Web API Basics
Web API BasicsWeb API Basics
Web API Basics
 
RESTful services
RESTful servicesRESTful services
RESTful services
 
Restful web services ppt
Restful web services pptRestful web services ppt
Restful web services ppt
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developers
 
APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...
APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...
APIs, REST e RESTful: O que os programadores precisam saber? - Marcos Echevar...
 
Rest API
Rest APIRest API
Rest API
 
Introdução APIs RESTful
Introdução APIs RESTfulIntrodução APIs RESTful
Introdução APIs RESTful
 
Introduction to REST - API
Introduction to REST - APIIntroduction to REST - API
Introduction to REST - API
 
REST API Design & Development
REST API Design & DevelopmentREST API Design & Development
REST API Design & Development
 
Api Testing
Api TestingApi Testing
Api Testing
 
introduction about REST API
introduction about REST APIintroduction about REST API
introduction about REST API
 
API
APIAPI
API
 
Rest presentation
Rest  presentationRest  presentation
Rest presentation
 
WebSockets with Spring 4
WebSockets with Spring 4WebSockets with Spring 4
WebSockets with Spring 4
 
How To Design A Good A P I And Why It Matters G O O G L E
How To Design A Good  A P I And Why It Matters    G O O G L EHow To Design A Good  A P I And Why It Matters    G O O G L E
How To Design A Good A P I And Why It Matters G O O G L E
 
Day02 a pi.
Day02   a pi.Day02   a pi.
Day02 a pi.
 
REST API 설계
REST API 설계REST API 설계
REST API 설계
 

Semelhante a The Internet as Web Services: introduction to ReST

REST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesREST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesPaul Fremantle
 
The Evolving Security Environment For Web Services
The Evolving Security Environment For Web ServicesThe Evolving Security Environment For Web Services
The Evolving Security Environment For Web ServicesQanita Ahmad
 
Mobility & Data Strategies
Mobility & Data StrategiesMobility & Data Strategies
Mobility & Data StrategiesSam Basu
 
OData Across Boundaries
OData Across BoundariesOData Across Boundaries
OData Across BoundariesSam Basu
 
Introduction to Semantic Web for GIS Practitioners
Introduction to Semantic Web for GIS PractitionersIntroduction to Semantic Web for GIS Practitioners
Introduction to Semantic Web for GIS PractitionersEmanuele Della Valle
 
Grokking REST (ZendCon 2010)
Grokking REST (ZendCon 2010)Grokking REST (ZendCon 2010)
Grokking REST (ZendCon 2010)Ben Ramsey
 
Semantic Web, an introduction for bioscientists
Semantic Web, an introduction for bioscientistsSemantic Web, an introduction for bioscientists
Semantic Web, an introduction for bioscientistsEmanuele Della Valle
 
WCF Data Services - Bandung Charity Event - 2010
WCF Data Services  - Bandung Charity Event - 2010WCF Data Services  - Bandung Charity Event - 2010
WCF Data Services - Bandung Charity Event - 2010Andri Yadi
 
Build APIs With Kapow Mashup Server
Build APIs With Kapow Mashup ServerBuild APIs With Kapow Mashup Server
Build APIs With Kapow Mashup ServerAndreas Krohn
 
Azure & WP7 at GRDevDay
Azure & WP7 at GRDevDayAzure & WP7 at GRDevDay
Azure & WP7 at GRDevDaySam Basu
 
Building RESTful Applications with OData
Building RESTful Applications with ODataBuilding RESTful Applications with OData
Building RESTful Applications with ODataTodd Anglin
 
Web of Things - Connecting People and Objects on the Web
Web of Things - Connecting People and Objects on the WebWeb of Things - Connecting People and Objects on the Web
Web of Things - Connecting People and Objects on the WebDominique Guinard
 
API Design and WebSocket
API Design and WebSocketAPI Design and WebSocket
API Design and WebSocketFrank Greco
 
Azure + WP7 - CodePaLOUsa
Azure + WP7 - CodePaLOUsaAzure + WP7 - CodePaLOUsa
Azure + WP7 - CodePaLOUsaSam Basu
 
Constraints Make You Sexy - What is Rest
Constraints Make You Sexy  - What is RestConstraints Make You Sexy  - What is Rest
Constraints Make You Sexy - What is Restanorqiu
 

Semelhante a The Internet as Web Services: introduction to ReST (20)

REST Presentation
REST PresentationREST Presentation
REST Presentation
 
REST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesREST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and Lies
 
Modified REST Presentation
Modified REST PresentationModified REST Presentation
Modified REST Presentation
 
The Evolving Security Environment For Web Services
The Evolving Security Environment For Web ServicesThe Evolving Security Environment For Web Services
The Evolving Security Environment For Web Services
 
Mobility & Data Strategies
Mobility & Data StrategiesMobility & Data Strategies
Mobility & Data Strategies
 
OData Across Boundaries
OData Across BoundariesOData Across Boundaries
OData Across Boundaries
 
Introduction to Semantic Web for GIS Practitioners
Introduction to Semantic Web for GIS PractitionersIntroduction to Semantic Web for GIS Practitioners
Introduction to Semantic Web for GIS Practitioners
 
Grokking REST (ZendCon 2010)
Grokking REST (ZendCon 2010)Grokking REST (ZendCon 2010)
Grokking REST (ZendCon 2010)
 
Helping Things to REST
Helping Things to RESTHelping Things to REST
Helping Things to REST
 
Semantic Web, an introduction for bioscientists
Semantic Web, an introduction for bioscientistsSemantic Web, an introduction for bioscientists
Semantic Web, an introduction for bioscientists
 
WCF Data Services - Bandung Charity Event - 2010
WCF Data Services  - Bandung Charity Event - 2010WCF Data Services  - Bandung Charity Event - 2010
WCF Data Services - Bandung Charity Event - 2010
 
Build APIs With Kapow Mashup Server
Build APIs With Kapow Mashup ServerBuild APIs With Kapow Mashup Server
Build APIs With Kapow Mashup Server
 
Azure & WP7 at GRDevDay
Azure & WP7 at GRDevDayAzure & WP7 at GRDevDay
Azure & WP7 at GRDevDay
 
Building RESTful Applications with OData
Building RESTful Applications with ODataBuilding RESTful Applications with OData
Building RESTful Applications with OData
 
Web of Things - Connecting People and Objects on the Web
Web of Things - Connecting People and Objects on the WebWeb of Things - Connecting People and Objects on the Web
Web of Things - Connecting People and Objects on the Web
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
Web 2 0 Tools
Web 2 0 ToolsWeb 2 0 Tools
Web 2 0 Tools
 
API Design and WebSocket
API Design and WebSocketAPI Design and WebSocket
API Design and WebSocket
 
Azure + WP7 - CodePaLOUsa
Azure + WP7 - CodePaLOUsaAzure + WP7 - CodePaLOUsa
Azure + WP7 - CodePaLOUsa
 
Constraints Make You Sexy - What is Rest
Constraints Make You Sexy  - What is RestConstraints Make You Sexy  - What is Rest
Constraints Make You Sexy - What is Rest
 

Mais de Bruno Kessler Foundation

Mais de Bruno Kessler Foundation (12)

Collective Memories in Wikipedia - LiveMemories final review
Collective Memories in Wikipedia - LiveMemories final reviewCollective Memories in Wikipedia - LiveMemories final review
Collective Memories in Wikipedia - LiveMemories final review
 
Psychological processes underlying Wikipedia representations of natural and m...
Psychological processes underlying Wikipedia representations of natural and m...Psychological processes underlying Wikipedia representations of natural and m...
Psychological processes underlying Wikipedia representations of natural and m...
 
Editing behavior of wikipedia editors
Editing behavior of wikipedia editorsEditing behavior of wikipedia editors
Editing behavior of wikipedia editors
 
Decomposing discussion forums using user roles
Decomposing discussion forums using user rolesDecomposing discussion forums using user roles
Decomposing discussion forums using user roles
 
It’s a Network, Not an Encyclopedia
It’s a Network,Not an EncyclopediaIt’s a Network,Not an Encyclopedia
It’s a Network, Not an Encyclopedia
 
Sonet Demonstration LiveMemories 26 11 09
Sonet Demonstration LiveMemories 26 11 09Sonet Demonstration LiveMemories 26 11 09
Sonet Demonstration LiveMemories 26 11 09
 
Showcase selection for LiveMemories
Showcase selection for LiveMemoriesShowcase selection for LiveMemories
Showcase selection for LiveMemories
 
Newsticker25 11 08
Newsticker25 11 08Newsticker25 11 08
Newsticker25 11 08
 
Fbk Seminar Michela Ferron
Fbk Seminar Michela FerronFbk Seminar Michela Ferron
Fbk Seminar Michela Ferron
 
Possible Casestudies So Net 14 11 08
Possible Casestudies So Net 14 11 08Possible Casestudies So Net 14 11 08
Possible Casestudies So Net 14 11 08
 
BBC Memoryshare: Past, Present and Future
BBC Memoryshare: Past, Present and FutureBBC Memoryshare: Past, Present and Future
BBC Memoryshare: Past, Present and Future
 
The Power of Social Media
The Power of Social MediaThe Power of Social Media
The Power of Social Media
 

Último

Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 

Último (20)

Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 

The Internet as Web Services: introduction to ReST

  • 1. The Internet as Web Services: introduction to ReST
  • 2. Oscar Zambotti is a student of Information Technology at the Faculty of Science, University of Trento. He attended the 9-months course &quot;ICT secure programming expert&quot; in Bozen offered by the European Social Fund. Now he's in FBK for his stage period in the SoNet Group and following the “ Presentation or die ” motto is giving this presentation in the very beginning of his stage. Oscar is very interested in social networking and programming applications about it. He is also a speaker and DJ in a local radio station. http://www.oskarnrk.net [email_address] Bio “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
  • 3.
  • 6. How am I going to use ReST? What am I going to talk about? “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
  • 7. 1. What is a Web Service?
  • 8. “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 “ The challenge now is to join forces to research on Software & Services Technologies, to bring advances to the market and to ensure European leadership in the new Internet economy: The Internet of Services.” Internet of Services, Software and Virtualisation - Objective ICT 2009.1.2, Call 5 of the Seventh Framework Programme (2007-2013) European Commission - Information Society and Media “ The Internet has shown remarkable resilience and flexibility in the face of ever increasing numbers of users, data volume, and changing usage patterns, but faces growing challenges in meetings the needs of our knowledge society. This is the moment to start designing the Internet of the Future.” Future Internet - Research programs of the CIT (Center for Innovation Technology) Fondazione Bruno Kessler The vision of the “Future Internet”
  • 9.
  • 11. Access limitations? What is a web service? “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
  • 12. Use of web services? E.g. Flickrvision “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 Flickr photos with Google Maps
  • 13. A mashup is a Web application that combines data or functionality from one or more sources into a single integrated application. http://www.programmableweb.com “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 Web services for mashups
  • 14. “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 ProgrammableWeb statistics 1308 APIs 3957 Mashups (12 May 2009) The trend...
  • 15. 2. Different ways: SOAP and ReST
  • 16. SOAP ( Simple Object Access Protocol ) uses XML and RPC or HTTP . Businesses can register their WS on UDDI ( Universal Description, Discovery and Integration ) and provide documentation with WSDL ( Web Services Description Language ) “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 image: Wikipedia How to use a web service: SOAP image: Wikipedia
  • 17. <soapenv:Envelope xmlns:soapenv=&quot; http://schemas.xmlsoap.org/soap/envelope/ &quot; xmlns:xsd=&quot; http://www.w3.org/2001/XMLSchema &quot; xmlns:xsi=&quot; http://www.w3.org/2001/XMLSchema-instance &quot;> <soapenv:Body> <req:echo xmlns:req=&quot; http://localhost:8080/axis2/services/MyService/ &quot;> <req:category>classifieds</req:category> </req:echo> </soapenv:Body> </soapenv:Envelope> “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 How to use a web service: SOAP /2 Sample: Request...
  • 18. <soapenv:Envelope xmlns:soapenv=&quot; http://schemas.xmlsoap.org/soap/envelope/ &quot; xmlns:wsa=&quot; http://schemas.xmlsoap.org/ws/2004/08/addressing &quot;> <soapenv:Header> <wsa:ReplyTo> <wsa:Address> http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous </wsa:Address> </wsa:ReplyTo> <wsa:From> <wsa:Address> http://localhost:8080/axis2/services/MyService </wsa:Address> </wsa:From> <wsa:MessageID> ECE5B3F187F29D28BC11433905662036 </wsa:MessageID> </soapenv:Header> <soapenv:Body> <req:echo xmlns:req=&quot; http://localhost:8080/axis2/services/MyService/ &quot;> <req:category>classifieds</req:category> </req:echo> </soapenv:Body> </soapenv:Envelope> “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 How to use a web service: SOAP /3 ...Response
  • 19. ReST ( Representational State Transfer ) is an architectural style for distributed hypermedia systems, it is not just a method for building web services. Introduced by Roy Thomas Fielding in his dissertation to become Ph.D. in 2000. Resource -> URI Interaction -> Representation An application can interact with a resource by knowing the identifier of the resource (URI), and the action required (HTTP methods). ReST is stateless . How to use a web service: ReST “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
  • 20. HTTP consists in URIs, methods, status codes... The most important HTTP methods compose the basic functions in computer science: CRUD How to use a web service: ReST /2 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 HTTP CRUD SQL POST Create INSERT GET Read SELECT PUT Update UPDATE DELETE Delete DELETE
  • 21. http://example.com/losties How to use a web service: ReST /3 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 POST - C reate - GET - R ead - PUT - U pdate - DELETE - D elete - Create a new passenger List http://example.com/losties/4815162342 Response format: HTML, XML (RSS, Atom, “custom”) , JSON, ... Suggested reading: “How I explained ReST to my wife” (Ryan Tomayko) POST - C reate - GET - R ead - PUT - U pdate - DELETE - D elete - Passenger data Update passenger data Delete passenger
  • 22. An application is ReSTful when has resources accessible by representations. http://example.com/losties/4815162342 Some services are ReST-like : you use HTTP methods but using APIs methods as parameters (Flickr). http://example.com/losties/getLostie?id=4815162342 Nouns vs Verbs How to use a web service: ReST /4 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
  • 23. A large number of developers chooses ReST instead of SOAP. “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 SOAP vs. ReST on ProgrammableWeb
  • 24. 3. ReST examples (Python code)
  • 25. What is Twitter? Example: Twitter “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
  • 26. Twitter REST API Method: statuses/show Returns a single status, specified by the id parameter below. The status's author will be returned inline. URL: http://twitter.com/statuses/show/id.format Formats: xml, json, rss, atom HTTP Method(s): GET Requires Authentication: false, unless the author of the status is protected Example: Twitter /2 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 Twitter REST API Method: statuses/update Updates the authenticating user's status. Requires the status parameter specified below. Request must be a POST. A status update with text identical to the authenticating user's current status will be ignored to prevent duplicates. URL: http://twitter.com/statuses/update.format Formats: xml, json, rss, atom HTTP Method(s): POST Requires Authentication: true http://apiwiki.twitter.com/Twitter-API-Documentation Some methods require authentication (OAuth)
  • 27. import httplib # some code... def fetch_following(self): conn = httplib.HTTPConnection(&quot;twitter.com&quot;) conn.request(&quot;GET&quot;,&quot;/friends/ids/&quot;+self.screen_name+&quot;.json&quot;) r1 = conn.getresponse() print r1.read() conn.close() Example: Twitter /3 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 Output (sample!): user IDs [5428712,31528501,6603122,30304051,30303627,5159271, 17572031,15147484] Obj: fetch the list of the user IDs that a user is following
  • 28. What is Flickr? Screenshot Example: Flickr “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
  • 29. Developers need a couple of keys to use the APIs. Some methods require authentication. Example: Flickr /2 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
  • 30. REST Request Format REST is the simplest request format to use - it's a simple HTTP GET or POST action. The REST Endpoint URL is http://api.flickr.com/services/rest/ To request the flickr.test.echo service, invoke like this: http://api.flickr.com/services/rest/?method=flickr.test.echo&name=value By default, REST requests will send a REST response. Example: Flickr /3 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 http://www.flickr.com/services/api/ Some methods require authentication.
  • 31. import urllib, urllib2, json FRI = &quot; http://api.flickr.com/services/rest/ ?&quot; KEY = &quot;d00fa386476950f75555555555555555&quot; SECRET = &quot;cac879e555555555&quot; FORMAT = &quot;json&quot; # some code... def people_find_by_username(username): # some code... def contacts_get_public_list(username): nsid = people_find_by_username(username) req = {'method': CONTACTS_GETPUBLICLIST, 'api_key': KEY, 'user_id': nsid, 'format': FORMAT, 'nojsoncallback': 1} params = urllib.urlencode(req) contacts_public_list = urllib2.urlopen(FRI,params).read() print contacts_public_list Example: Flickr /4 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 HTTP POST (implicit) Obj: fetch the list of the friends a user
  • 32. Example: Flickr /5 “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 Output (sample!): collection (dictionaries, lists) {&quot;contacts&quot;: {&quot;page&quot;:1, &quot;pages&quot;:1, &quot;per_page&quot;:1000, &quot;perpage&quot;:1000, &quot;total&quot;:39, &quot;contact&quot;: [{&quot;nsid&quot;:&quot;81107858@N00&quot;, &quot;username&quot;:&quot;Jack&quot;, &quot;iconserver&quot;:&quot;207&quot;, &quot;iconfarm&quot;:1, &quot;ignored&quot;:0}, {&quot;nsid&quot;:&quot;23578585@N00&quot;, &quot;username&quot;:&quot;Locke&quot;, &quot;iconserver&quot;:&quot;211&quot;, &quot;iconfarm&quot;:1, &quot;ignored&quot;:0}, {&quot;nsid&quot;:&quot;81158128@N00&quot;, &quot;username&quot;:&quot;Sawyer&quot;, &quot;iconserver&quot;:&quot;147&quot;, &quot;iconfarm&quot;:1, &quot;ignored&quot;:0}, {&quot;nsid&quot;:&quot;29563291@N00&quot;, &quot;username&quot;:&quot;Hurley&quot;, &quot;iconserver&quot;:&quot;182&quot;, &quot;iconfarm&quot;:1, &quot;ignored&quot;:0}, {&quot;nsid&quot;:&quot;20347812@N00&quot;, &quot;username&quot;:&quot;Kate&quot;, &quot;iconserver&quot;:&quot;113&quot;, &quot;iconfarm&quot;:1, &quot;ignored&quot;:0}]}, &quot;stat&quot;:&quot;ok&quot;}
  • 33. 4. How am I going to use ReST?
  • 34. Web-based tool, with prepopulation using Web APIs, that displays the network of a user and its evolution over some social networks before and after a defined event . What am I going to do? Socialdash “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009
  • 35. Questions? Ideas? Suggestions? Thanks “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009 http://sonet.fbk.eu
  • 36.
  • 37. Strategic guidelines in FBK: the Future Internet http://cit.fbk.eu/future_internet
  • 39. Representational State Transfer (ReST) by Roy Thomas Fielding http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm http://www.ics.uci.edu/~fielding/
  • 40. Suggested readings: http://tomayko.com/writings/rest-to-my-wife Bibliography “ The Internet as Web Services: introduction to ReST” – Oscar Zambotti, 2009