SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
REST

Representational State Transfer
whoami

Colin Harrington
 ● colin.harrington@objectpartners.com
 ● colin@colinharrington.net
 ● http://colinharrington.net
 ● @ColinHarrington
History

HTTP :: HyperText Transfer Protocol
Tim Berners-Lee :: 1990s

Foundations of the Web

OSI Layer 7
Application Layer


Protocol
History

REST :: Representational State Transfer

2000 Doctoral Dissertation by Roy T. Fielding
http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

"Roy Thomas Fielding (born 1965) is an American computer
scientist[1], one of the principal authors of the HTTP specification, an
authority on computer network architecture[2] and co-founder of the
Apache HTTP Server project." (Wikipedia)
http://roy.gbiv.com/

@fielding
History - REST
Architecture:
 ● Client-Server
 ● Stateless + Cacheable
 ● Uniform Interface + Layerable

Data:
 ● Resources, identifiers & metadata
 ● Representation & metadata
 ● Control Data { headers }

Elements:
 ● {clients, server, resolver, cache}
 ● Gateways, proxies, user agents
 ● URL, URI, Schemes
REST

REST is a buzzword and a movement but it symbolizes a coherent
usage of the web (HTTP) as it was designed




            REST ~ HTTP done right.
Resources

Uniform Resource Identifiers (URI)

       <scheme>:<scheme-specified-structure>

 ● ftp://example.org/resource.txt
 ● urn:issn:1535-3613
 ● mailto:colin@colinharrington.net


Uniform Resource Locator (URL)

            scheme://domain:port/path?query_string
HTTP Methods/Verbs

HEAD, GET, OPTIONS => considered "safe"
PUT, POST, DELETE => possibly destructive
TRACE, DEBUG => Considered harmful


curl -v http://www.google.com

GET / HTTP/1.1
User-Agent: curl/7.21.0
Host: www.google.com
Accept: */*
Accept Headers :: Client

GET / HTTP/1.1
User-Agent: curl/7.21.0
Host: www.google.com
Accept: */*


Accept: application/xml


Accept: text/html,application/xhtml+xml,
application/xml;q=0.9,*/*;q=0.8,
application/json
HTTP Status Codes

200 - OK
301 - Moved permanently
302 - Moved temporarily
404 - Not Found
500
            http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

HTTP/1.1 200 OK
Date: Mon, 31 Oct 2011 16:07:53 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
http://homestarrunner.com/404d
Representations

                    JSON Example
 ● XML              {
                         "firstName": "John",
                         "lastName" : "Smith",
                         "age"       : 25,
 ● JSON                  "address" :
                         {
                             "streetAddress": "21 2nd Street",
                             "city"          : "New York",
 ● HTML                      "state"         : "NY",
                             "postalCode"    : "10021"
                         },
                         "phoneNumber":
 ● XHTML                 [
                             {
                                "type" : "home",
                                "number": "212 555-1234"
 ● RDF                       },
                             {
                                "type" : "fax",
                                "number": "646 555-4567"
 ● Text                  ]
                             }

                      }

 ● Custom Formats
Content Negotiation

Request:
Accept Header
 Accept: application/xml

Accept-Language
Accept-Encoding

Response:
Content-Type: text/json

Accept: text/html,application/xhtml+xml,
application/xml;q=0.9,*/*;q=0.8,
application/json
Cacheability

HTTP Cache Headers

 ● Expires
 ● Cache-Control
 ● ETag
 ● Last-Modified
 ● Pragma no-cache

Proxy & Network path.
CRUD

                                            Create :: POST

                                              Read :: GET

                                             Update :: PUT

                                         Delete :: DELETE




* http://stackoverflow.com/questions/630453/put-vs-post-in-rest
Hypermedia

Linking
          to other resources / media

HTML documents, resources
loosely coupled
Images, CSS, favicon, etc.




Like this image ->
http://cuip.uchicago.edu/~cac/images/Hypermedia.jpg
Who

http://www.programmableweb.com/

Amazon Web Services
 {S3, EC2, SQS, RDS, FPS, etc.}




Just to name a few...
Resources
This guy explains REST in to his non-technical wife:
http://tomayko.com/writings/rest-to-my-wife

Good article on how to REST with curl:
http://blogs.plexibus.com/2009/01/15/rest-esting-with-curl/

Poster -- the Firefox plugin:
https://addons.mozilla.org/en-US/firefox/addon/poster/

You'd probably learn best by actually making some RESTful
calls. Pick a service that is free and RESTful and play around with it. I'd
recommend using http://www.twilio.com/ just because they offer you
$30 in free credit and you get to make, receive and control real phone
calls.
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

Altitude SF 2017: Privacy protection by proxy
Altitude SF 2017: Privacy protection by proxyAltitude SF 2017: Privacy protection by proxy
Altitude SF 2017: Privacy protection by proxyFastly
 
Mongo DB schema design patterns
Mongo DB schema design patternsMongo DB schema design patterns
Mongo DB schema design patternsjoergreichert
 
MongoDB Mojo: Building a Basic Perl App
MongoDB Mojo: Building a Basic Perl AppMongoDB Mojo: Building a Basic Perl App
MongoDB Mojo: Building a Basic Perl AppStennie Steneker
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source BridgeChris Anderson
 
OpenSearch 2010-09
OpenSearch 2010-09OpenSearch 2010-09
OpenSearch 2010-09Oscar Fonts
 
Mongo db datatypes
Mongo db datatypesMongo db datatypes
Mongo db datatypeszarigatongy
 
Jsonp null-meet-02-2015
Jsonp null-meet-02-2015Jsonp null-meet-02-2015
Jsonp null-meet-02-2015Sunil Kumar
 
Using historical open data for family history - and the value of GB1900 data
Using historical open data for family history - and the value of GB1900 dataUsing historical open data for family history - and the value of GB1900 data
Using historical open data for family history - and the value of GB1900 dataTom Pert
 
Introduction to MongoDB for C# developers
Introduction to MongoDB for C# developersIntroduction to MongoDB for C# developers
Introduction to MongoDB for C# developersTaras Romanyk
 

Was ist angesagt? (13)

Altitude SF 2017: Privacy protection by proxy
Altitude SF 2017: Privacy protection by proxyAltitude SF 2017: Privacy protection by proxy
Altitude SF 2017: Privacy protection by proxy
 
Mongo DB schema design patterns
Mongo DB schema design patternsMongo DB schema design patterns
Mongo DB schema design patterns
 
MongoDB FabLab León
MongoDB FabLab LeónMongoDB FabLab León
MongoDB FabLab León
 
JSOP in 60 seconds
JSOP in 60 secondsJSOP in 60 seconds
JSOP in 60 seconds
 
MongoDB Mojo: Building a Basic Perl App
MongoDB Mojo: Building a Basic Perl AppMongoDB Mojo: Building a Basic Perl App
MongoDB Mojo: Building a Basic Perl App
 
CouchDB Open Source Bridge
CouchDB Open Source BridgeCouchDB Open Source Bridge
CouchDB Open Source Bridge
 
OpenSearch 2010-09
OpenSearch 2010-09OpenSearch 2010-09
OpenSearch 2010-09
 
Mongo db datatypes
Mongo db datatypesMongo db datatypes
Mongo db datatypes
 
Gopher Vs HTTP
Gopher Vs HTTPGopher Vs HTTP
Gopher Vs HTTP
 
Jsonp null-meet-02-2015
Jsonp null-meet-02-2015Jsonp null-meet-02-2015
Jsonp null-meet-02-2015
 
MongoDB
MongoDBMongoDB
MongoDB
 
Using historical open data for family history - and the value of GB1900 data
Using historical open data for family history - and the value of GB1900 dataUsing historical open data for family history - and the value of GB1900 data
Using historical open data for family history - and the value of GB1900 data
 
Introduction to MongoDB for C# developers
Introduction to MongoDB for C# developersIntroduction to MongoDB for C# developers
Introduction to MongoDB for C# developers
 

Ähnlich wie Brief Introduction to REST

HTTP protocol and Streams Security
HTTP protocol and Streams SecurityHTTP protocol and Streams Security
HTTP protocol and Streams SecurityBlueinfy Solutions
 
Introducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No ProblemIntroducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No ProblemAndrew Liu
 
FIWARE Global Summit - Hands-On NGSI-LD
FIWARE Global Summit - Hands-On NGSI-LDFIWARE Global Summit - Hands-On NGSI-LD
FIWARE Global Summit - Hands-On NGSI-LDFIWARE
 
R-Users Group JSON and ReST Introduction using Twitter
R-Users Group JSON and ReST Introduction using TwitterR-Users Group JSON and ReST Introduction using Twitter
R-Users Group JSON and ReST Introduction using TwitterKevin Smith
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHPZoran Jeremic
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHPZoran Jeremic
 
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramSession 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramFIWARE
 
FIWARE Training: JSON-LD and NGSI-LD
FIWARE Training: JSON-LD and NGSI-LDFIWARE Training: JSON-LD and NGSI-LD
FIWARE Training: JSON-LD and NGSI-LDFIWARE
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web ArchitectureChamnap Chhorn
 
Data integration
Data integrationData integration
Data integrationBallerina
 
Design Web Service API by HungerStation
Design Web Service API by HungerStationDesign Web Service API by HungerStation
Design Web Service API by HungerStationArabNet ME
 
Comparison with storing data using NoSQL(CouchDB) and a relational database.
Comparison with storing data using NoSQL(CouchDB) and a relational database.Comparison with storing data using NoSQL(CouchDB) and a relational database.
Comparison with storing data using NoSQL(CouchDB) and a relational database.eross77
 
[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyondCarles Farré
 
Alexander Sibiryakov- Frontera
Alexander Sibiryakov- FronteraAlexander Sibiryakov- Frontera
Alexander Sibiryakov- FronteraPyData
 
Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2kriszyp
 
OpenSouthCode 2018 - Integrating your applications easily with Apache Camel
OpenSouthCode 2018 - Integrating your applications easily with Apache CamelOpenSouthCode 2018 - Integrating your applications easily with Apache Camel
OpenSouthCode 2018 - Integrating your applications easily with Apache CamelJosé Román Martín Gil
 
JSON-LD and NGSI-LD
JSON-LD and NGSI-LDJSON-LD and NGSI-LD
JSON-LD and NGSI-LDFIWARE
 
JSON Fuzzing: New approach to old problems
JSON Fuzzing: New  approach to old problemsJSON Fuzzing: New  approach to old problems
JSON Fuzzing: New approach to old problemstitanlambda
 

Ähnlich wie Brief Introduction to REST (20)

HTTP protocol and Streams Security
HTTP protocol and Streams SecurityHTTP protocol and Streams Security
HTTP protocol and Streams Security
 
Introducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No ProblemIntroducing Azure DocumentDB - NoSQL, No Problem
Introducing Azure DocumentDB - NoSQL, No Problem
 
FIWARE Global Summit - Hands-On NGSI-LD
FIWARE Global Summit - Hands-On NGSI-LDFIWARE Global Summit - Hands-On NGSI-LD
FIWARE Global Summit - Hands-On NGSI-LD
 
R-Users Group JSON and ReST Introduction using Twitter
R-Users Group JSON and ReST Introduction using TwitterR-Users Group JSON and ReST Introduction using Twitter
R-Users Group JSON and ReST Introduction using Twitter
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHP
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
 
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers ProgramSession 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
Session 2 - NGSI-LD primer & Smart Data Models | Train the Trainers Program
 
FIWARE Training: JSON-LD and NGSI-LD
FIWARE Training: JSON-LD and NGSI-LDFIWARE Training: JSON-LD and NGSI-LD
FIWARE Training: JSON-LD and NGSI-LD
 
Introduction to Web Architecture
Introduction to Web ArchitectureIntroduction to Web Architecture
Introduction to Web Architecture
 
Data integration
Data integrationData integration
Data integration
 
Os Gottfrid
Os GottfridOs Gottfrid
Os Gottfrid
 
Design Web Service API by HungerStation
Design Web Service API by HungerStationDesign Web Service API by HungerStation
Design Web Service API by HungerStation
 
Comparison with storing data using NoSQL(CouchDB) and a relational database.
Comparison with storing data using NoSQL(CouchDB) and a relational database.Comparison with storing data using NoSQL(CouchDB) and a relational database.
Comparison with storing data using NoSQL(CouchDB) and a relational database.
 
[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond[DSBW Spring 2010] Unit 10: XML and Web And beyond
[DSBW Spring 2010] Unit 10: XML and Web And beyond
 
Alexander Sibiryakov- Frontera
Alexander Sibiryakov- FronteraAlexander Sibiryakov- Frontera
Alexander Sibiryakov- Frontera
 
Json at work overview and ecosystem-v2.0
Json at work   overview and ecosystem-v2.0Json at work   overview and ecosystem-v2.0
Json at work overview and ecosystem-v2.0
 
Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2Java Script Based Client Server Webapps 2
Java Script Based Client Server Webapps 2
 
OpenSouthCode 2018 - Integrating your applications easily with Apache Camel
OpenSouthCode 2018 - Integrating your applications easily with Apache CamelOpenSouthCode 2018 - Integrating your applications easily with Apache Camel
OpenSouthCode 2018 - Integrating your applications easily with Apache Camel
 
JSON-LD and NGSI-LD
JSON-LD and NGSI-LDJSON-LD and NGSI-LD
JSON-LD and NGSI-LD
 
JSON Fuzzing: New approach to old problems
JSON Fuzzing: New  approach to old problemsJSON Fuzzing: New  approach to old problems
JSON Fuzzing: New approach to old problems
 

Kürzlich hochgeladen

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Kürzlich hochgeladen (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Brief Introduction to REST

  • 2. whoami Colin Harrington ● colin.harrington@objectpartners.com ● colin@colinharrington.net ● http://colinharrington.net ● @ColinHarrington
  • 3. History HTTP :: HyperText Transfer Protocol Tim Berners-Lee :: 1990s Foundations of the Web OSI Layer 7 Application Layer Protocol
  • 4. History REST :: Representational State Transfer 2000 Doctoral Dissertation by Roy T. Fielding http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm "Roy Thomas Fielding (born 1965) is an American computer scientist[1], one of the principal authors of the HTTP specification, an authority on computer network architecture[2] and co-founder of the Apache HTTP Server project." (Wikipedia) http://roy.gbiv.com/ @fielding
  • 5. History - REST Architecture: ● Client-Server ● Stateless + Cacheable ● Uniform Interface + Layerable Data: ● Resources, identifiers & metadata ● Representation & metadata ● Control Data { headers } Elements: ● {clients, server, resolver, cache} ● Gateways, proxies, user agents ● URL, URI, Schemes
  • 6. REST REST is a buzzword and a movement but it symbolizes a coherent usage of the web (HTTP) as it was designed REST ~ HTTP done right.
  • 7. Resources Uniform Resource Identifiers (URI) <scheme>:<scheme-specified-structure> ● ftp://example.org/resource.txt ● urn:issn:1535-3613 ● mailto:colin@colinharrington.net Uniform Resource Locator (URL) scheme://domain:port/path?query_string
  • 8. HTTP Methods/Verbs HEAD, GET, OPTIONS => considered "safe" PUT, POST, DELETE => possibly destructive TRACE, DEBUG => Considered harmful curl -v http://www.google.com GET / HTTP/1.1 User-Agent: curl/7.21.0 Host: www.google.com Accept: */*
  • 9. Accept Headers :: Client GET / HTTP/1.1 User-Agent: curl/7.21.0 Host: www.google.com Accept: */* Accept: application/xml Accept: text/html,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8, application/json
  • 10. HTTP Status Codes 200 - OK 301 - Moved permanently 302 - Moved temporarily 404 - Not Found 500 http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html HTTP/1.1 200 OK Date: Mon, 31 Oct 2011 16:07:53 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1
  • 12. Representations JSON Example ● XML { "firstName": "John", "lastName" : "Smith", "age" : 25, ● JSON "address" : { "streetAddress": "21 2nd Street", "city" : "New York", ● HTML "state" : "NY", "postalCode" : "10021" }, "phoneNumber": ● XHTML [ { "type" : "home", "number": "212 555-1234" ● RDF }, { "type" : "fax", "number": "646 555-4567" ● Text ] } } ● Custom Formats
  • 13. Content Negotiation Request: Accept Header Accept: application/xml Accept-Language Accept-Encoding Response: Content-Type: text/json Accept: text/html,application/xhtml+xml, application/xml;q=0.9,*/*;q=0.8, application/json
  • 14. Cacheability HTTP Cache Headers ● Expires ● Cache-Control ● ETag ● Last-Modified ● Pragma no-cache Proxy & Network path.
  • 15. CRUD Create :: POST Read :: GET Update :: PUT Delete :: DELETE * http://stackoverflow.com/questions/630453/put-vs-post-in-rest
  • 16. Hypermedia Linking to other resources / media HTML documents, resources loosely coupled Images, CSS, favicon, etc. Like this image -> http://cuip.uchicago.edu/~cac/images/Hypermedia.jpg
  • 17. Who http://www.programmableweb.com/ Amazon Web Services {S3, EC2, SQS, RDS, FPS, etc.} Just to name a few...
  • 18. Resources This guy explains REST in to his non-technical wife: http://tomayko.com/writings/rest-to-my-wife Good article on how to REST with curl: http://blogs.plexibus.com/2009/01/15/rest-esting-with-curl/ Poster -- the Firefox plugin: https://addons.mozilla.org/en-US/firefox/addon/poster/ You'd probably learn best by actually making some RESTful calls. Pick a service that is free and RESTful and play around with it. I'd recommend using http://www.twilio.com/ just because they offer you $30 in free credit and you get to make, receive and control real phone calls.