SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Your data needs to be
promiscuous
If there’s any hope of it
hooking up with the iPhone
Your data needs to be
promiscuous
If there’s any hope of it
hooking up with the iPhone
API
•       The I means Interface
•       Necessary to interact with any application
        outside of a web site
    •    Smart phone
    •    Ajax
BPEL
 SOAP



RPC     WSDL
Facebook
Twitter
REST
•   Representational
•   State
•   Transfer
Representing State
•   JSON
•   HTML
•   PDF
•   XML?
XML

James Clark:
 “My reaction to JSON is a combination of ‘Yay’ and ‘Sigh’.
 It's ‘Yay’, because for important use cases JSON is dramatically better
 than XML. In particular, JSON shines as a programming language-
 independent representation of typical programming language data
 structures. This is an incredibly important use case and it would be hard
 to overstate how appallingly bad XML is for this. The fundamental
 problem is the mismatch between programming language data structures
 and the XML element/attribute data model of elements.”
Verbs
•   GET: Retrieve data
•   PUT: Replace data
•   POST: Add data
•   [PATCH]: Update data
•   DELETE: Remove data
HTTP
Collections
•       GET: List items in a collection
•       PUT: Replace a collection with new items
    •    Functions as a PATCH in the real world
•       POST: Add an item to this collection
    •    New or existing item
•       DELETE: Remove all items in this collection
    •    There be danger
Item
•       GET: Retrieve the representation of this item
•       PUT: Update the item with new values
    •    Functions as PATCH in the real world
•       DELETE: Remove the item
Uniformity
•       Relative to a base URL
    •    A description of resources often placed here
•       Collections are identified by the type of object in
        the collection
    •    http://baseurl/resource/
•       Items are identified by the type and ID of the
        item
    •    http://baseurl/resource/12
•       Collections can be related to a specific item
    •    http://bareurl/parent/12/resource
Varied Representations
•       Requesting a return type may be done through
        resource URL
    •    http://baseurl/resource/12.json
    •    http://baseurl/resource/12.html
•       Requesting a return type may be done through
        Accept header
    •    Accept: application/json
Responses
•       Use HTTP error codes where appropriate
•       Standardize a method of measuring success
•       Standardize a method of returning errors
    •    Add an error flag
    •    State the main error message
    •    State the error type
    •    Allow data to be conveyed along with the error
Blog
•       Uses many REST patterns
•       Collection of posts often at /blog/
    •    Object type used for lookup
•       Items usually at /blog/id
•       Items can be added to a category “collection” of
        posts
Caching
•       GET requests can be cached by browsers
    •    Should never alter state
    •    Several headers in the return enable it
•       No other verbs will be cached regardless of
        headers
HTTP
Security
•       Date, URL, content can be combined and hashed
    •    HMAC-SHA-1 with a secret key
    •    API ID sent in a header
    •    Used by many Amazon services

Weitere ähnliche Inhalte

Was ist angesagt?

Beautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with IonBeautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with IonStormpath
 
At Begin, URL Handling and REST
At Begin, URL Handling and RESTAt Begin, URL Handling and REST
At Begin, URL Handling and RESTBrian Loomis
 
A Survey of Elasticsearch Usage
A Survey of Elasticsearch UsageA Survey of Elasticsearch Usage
A Survey of Elasticsearch UsageGreg Brown
 
Links - IntraSystem and Absolute
Links - IntraSystem and AbsoluteLinks - IntraSystem and Absolute
Links - IntraSystem and Absolutenikkeisaurus
 
Elasticsearch at Automattic
Elasticsearch at AutomatticElasticsearch at Automattic
Elasticsearch at AutomatticGreg Brown
 
Cool bonsai cool - an introduction to ElasticSearch
Cool bonsai cool - an introduction to ElasticSearchCool bonsai cool - an introduction to ElasticSearch
Cool bonsai cool - an introduction to ElasticSearchclintongormley
 
Implementing Site Search in CQ5 / AEM
Implementing Site Search in CQ5 / AEMImplementing Site Search in CQ5 / AEM
Implementing Site Search in CQ5 / AEMrtpaem
 
Little rock data management 032621
Little rock data management 032621Little rock data management 032621
Little rock data management 032621Brandon Smith
 
Coming to REST
Coming to RESTComing to REST
Coming to RESTMax Goff
 
Finding knowledge, data and answers on the Semantic Web
Finding knowledge, data and answers on the Semantic WebFinding knowledge, data and answers on the Semantic Web
Finding knowledge, data and answers on the Semantic Webebiquity
 
Architecture of a search engine
Architecture of a search engineArchitecture of a search engine
Architecture of a search engineSylvain Utard
 
Building an unstructured data management solution with elastic search and ama...
Building an unstructured data management solution with elastic search and ama...Building an unstructured data management solution with elastic search and ama...
Building an unstructured data management solution with elastic search and ama...mobiusservices
 
Effective Searching by Dominik Kornas
Effective Searching by Dominik KornasEffective Searching by Dominik Kornas
Effective Searching by Dominik KornasAEM HUB
 
Library Mashups & APIs
Library Mashups & APIsLibrary Mashups & APIs
Library Mashups & APIslibrarywebchic
 
Hack angular wildly
Hack angular wildlyHack angular wildly
Hack angular wildlyTodd Warren
 

Was ist angesagt? (20)

Beautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with IonBeautiful REST+JSON APIs with Ion
Beautiful REST+JSON APIs with Ion
 
Building a spa_in_30min
Building a spa_in_30minBuilding a spa_in_30min
Building a spa_in_30min
 
At Begin, URL Handling and REST
At Begin, URL Handling and RESTAt Begin, URL Handling and REST
At Begin, URL Handling and REST
 
A Survey of Elasticsearch Usage
A Survey of Elasticsearch UsageA Survey of Elasticsearch Usage
A Survey of Elasticsearch Usage
 
Links - IntraSystem and Absolute
Links - IntraSystem and AbsoluteLinks - IntraSystem and Absolute
Links - IntraSystem and Absolute
 
Elasticsearch at Automattic
Elasticsearch at AutomatticElasticsearch at Automattic
Elasticsearch at Automattic
 
Parse
ParseParse
Parse
 
Drupal feeds
Drupal feedsDrupal feeds
Drupal feeds
 
Cool bonsai cool - an introduction to ElasticSearch
Cool bonsai cool - an introduction to ElasticSearchCool bonsai cool - an introduction to ElasticSearch
Cool bonsai cool - an introduction to ElasticSearch
 
Implementing Site Search in CQ5 / AEM
Implementing Site Search in CQ5 / AEMImplementing Site Search in CQ5 / AEM
Implementing Site Search in CQ5 / AEM
 
Little rock data management 032621
Little rock data management 032621Little rock data management 032621
Little rock data management 032621
 
Coming to REST
Coming to RESTComing to REST
Coming to REST
 
Finding knowledge, data and answers on the Semantic Web
Finding knowledge, data and answers on the Semantic WebFinding knowledge, data and answers on the Semantic Web
Finding knowledge, data and answers on the Semantic Web
 
Architecture of a search engine
Architecture of a search engineArchitecture of a search engine
Architecture of a search engine
 
Jinchao demo
Jinchao demoJinchao demo
Jinchao demo
 
Building an unstructured data management solution with elastic search and ama...
Building an unstructured data management solution with elastic search and ama...Building an unstructured data management solution with elastic search and ama...
Building an unstructured data management solution with elastic search and ama...
 
Effective Searching by Dominik Kornas
Effective Searching by Dominik KornasEffective Searching by Dominik Kornas
Effective Searching by Dominik Kornas
 
Library Mashups & APIs
Library Mashups & APIsLibrary Mashups & APIs
Library Mashups & APIs
 
Xml and DTD's
Xml and DTD'sXml and DTD's
Xml and DTD's
 
Hack angular wildly
Hack angular wildlyHack angular wildly
Hack angular wildly
 

Ähnlich wie Rest

Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIsamesar0
 
Designing a RESTful web service
Designing a RESTful web serviceDesigning a RESTful web service
Designing a RESTful web serviceFilip Blondeel
 
The API Journey: from REST to GraphQL
The API Journey: from REST to GraphQLThe API Journey: from REST to GraphQL
The API Journey: from REST to GraphQLHaci Murat Yaman
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP TutorialLorna Mitchell
 
QueryPath, Mash-ups, and Web Services
QueryPath, Mash-ups, and Web ServicesQueryPath, Mash-ups, and Web Services
QueryPath, Mash-ups, and Web ServicesMatt Butcher
 
Restful webservice
Restful webserviceRestful webservice
Restful webserviceDong Ngoc
 
Shooting rabbits with sling
Shooting rabbits with slingShooting rabbits with sling
Shooting rabbits with slingTomasz Rękawek
 
RESTful for opentravel.org by HP
RESTful for opentravel.org by HPRESTful for opentravel.org by HP
RESTful for opentravel.org by HPRoni Schuetz
 
Mule soft RAML API Designing
Mule soft RAML API DesigningMule soft RAML API Designing
Mule soft RAML API DesigningRaja Reddy
 
Solr Recipes Workshop
Solr Recipes WorkshopSolr Recipes Workshop
Solr Recipes WorkshopErik Hatcher
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debateRestlet
 
Entity API in Drupal 8 (Drupal Tech Talk October 2014)
Entity API in Drupal 8 (Drupal Tech Talk October 2014)Entity API in Drupal 8 (Drupal Tech Talk October 2014)
Entity API in Drupal 8 (Drupal Tech Talk October 2014)Bart Feenstra
 
Entities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
Entities in Drupal 8 - Drupal Tech Talk - Bart FeenstraEntities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
Entities in Drupal 8 - Drupal Tech Talk - Bart FeenstraTriquanta
 
Mendix rest services
Mendix rest servicesMendix rest services
Mendix rest servicesG Acellam
 
HAL APIs and Ember Data
HAL APIs and Ember DataHAL APIs and Ember Data
HAL APIs and Ember DataCory Forsyth
 

Ähnlich wie Rest (20)

Pragmatic REST APIs
Pragmatic REST APIsPragmatic REST APIs
Pragmatic REST APIs
 
Designing a RESTful web service
Designing a RESTful web serviceDesigning a RESTful web service
Designing a RESTful web service
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
The API Journey: from REST to GraphQL
The API Journey: from REST to GraphQLThe API Journey: from REST to GraphQL
The API Journey: from REST to GraphQL
 
Web Services PHP Tutorial
Web Services PHP TutorialWeb Services PHP Tutorial
Web Services PHP Tutorial
 
QueryPath, Mash-ups, and Web Services
QueryPath, Mash-ups, and Web ServicesQueryPath, Mash-ups, and Web Services
QueryPath, Mash-ups, and Web Services
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
Restful webservice
Restful webserviceRestful webservice
Restful webservice
 
RestfulDesignRules
RestfulDesignRulesRestfulDesignRules
RestfulDesignRules
 
Shooting rabbits with sling
Shooting rabbits with slingShooting rabbits with sling
Shooting rabbits with sling
 
RESTful for opentravel.org by HP
RESTful for opentravel.org by HPRESTful for opentravel.org by HP
RESTful for opentravel.org by HP
 
Mule soft RAML API Designing
Mule soft RAML API DesigningMule soft RAML API Designing
Mule soft RAML API Designing
 
Solr Recipes Workshop
Solr Recipes WorkshopSolr Recipes Workshop
Solr Recipes Workshop
 
The never-ending REST API design debate
The never-ending REST API design debateThe never-ending REST API design debate
The never-ending REST API design debate
 
Entity API in Drupal 8 (Drupal Tech Talk October 2014)
Entity API in Drupal 8 (Drupal Tech Talk October 2014)Entity API in Drupal 8 (Drupal Tech Talk October 2014)
Entity API in Drupal 8 (Drupal Tech Talk October 2014)
 
Rest APIs Training
Rest APIs TrainingRest APIs Training
Rest APIs Training
 
Rest web services
Rest web servicesRest web services
Rest web services
 
Entities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
Entities in Drupal 8 - Drupal Tech Talk - Bart FeenstraEntities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
Entities in Drupal 8 - Drupal Tech Talk - Bart Feenstra
 
Mendix rest services
Mendix rest servicesMendix rest services
Mendix rest services
 
HAL APIs and Ember Data
HAL APIs and Ember DataHAL APIs and Ember Data
HAL APIs and Ember Data
 

Rest

  • 1. Your data needs to be promiscuous If there’s any hope of it hooking up with the iPhone
  • 2. Your data needs to be promiscuous If there’s any hope of it hooking up with the iPhone
  • 3. API • The I means Interface • Necessary to interact with any application outside of a web site • Smart phone • Ajax
  • 7. REST • Representational • State • Transfer
  • 8. Representing State • JSON • HTML • PDF • XML?
  • 9. XML James Clark: “My reaction to JSON is a combination of ‘Yay’ and ‘Sigh’. It's ‘Yay’, because for important use cases JSON is dramatically better than XML. In particular, JSON shines as a programming language- independent representation of typical programming language data structures. This is an incredibly important use case and it would be hard to overstate how appallingly bad XML is for this. The fundamental problem is the mismatch between programming language data structures and the XML element/attribute data model of elements.”
  • 10. Verbs • GET: Retrieve data • PUT: Replace data • POST: Add data • [PATCH]: Update data • DELETE: Remove data
  • 11. HTTP
  • 12. Collections • GET: List items in a collection • PUT: Replace a collection with new items • Functions as a PATCH in the real world • POST: Add an item to this collection • New or existing item • DELETE: Remove all items in this collection • There be danger
  • 13. Item • GET: Retrieve the representation of this item • PUT: Update the item with new values • Functions as PATCH in the real world • DELETE: Remove the item
  • 14. Uniformity • Relative to a base URL • A description of resources often placed here • Collections are identified by the type of object in the collection • http://baseurl/resource/ • Items are identified by the type and ID of the item • http://baseurl/resource/12 • Collections can be related to a specific item • http://bareurl/parent/12/resource
  • 15. Varied Representations • Requesting a return type may be done through resource URL • http://baseurl/resource/12.json • http://baseurl/resource/12.html • Requesting a return type may be done through Accept header • Accept: application/json
  • 16. Responses • Use HTTP error codes where appropriate • Standardize a method of measuring success • Standardize a method of returning errors • Add an error flag • State the main error message • State the error type • Allow data to be conveyed along with the error
  • 17. Blog • Uses many REST patterns • Collection of posts often at /blog/ • Object type used for lookup • Items usually at /blog/id • Items can be added to a category “collection” of posts
  • 18. Caching • GET requests can be cached by browsers • Should never alter state • Several headers in the return enable it • No other verbs will be cached regardless of headers
  • 19. HTTP
  • 20. Security • Date, URL, content can be combined and hashed • HMAC-SHA-1 with a secret key • API ID sent in a header • Used by many Amazon services

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n