SlideShare uma empresa Scribd logo
1 de 28
Baixar para ler offline
RPC to  Hypermedia
       REST
          

Concrete case on Payments API


       @andreineculau
RPC - Making a Remote Procedure Call

 1   client imagines :
 2       server . translate ’ Hello ’ , ’sv ’
 3
 4
 5   client sends :
 6       POST / rpc
 7        Content - Type : application / json
 8       {
 9            method :  translate  ,
10            args :    [ Hello  ,  sv ]
11       }


                                      1    server expects :
                                      2        app . post ’/ rpc ’ ,        ( req , res ) -
                                      3              fun = req . body . method # translate
                                      4              args = req . body . args #  Hello  ,  sv 
                                      5              call fun , args            #  Hej 
                                      6
                                      7
                                      8    server sends :
                                      9         200 OK
                                     10         Content - Type : application / json
                                     11        {
                                     12             result :  Hej 
                                     13        }
REST - Making a HTTP request

 1   client imagines :
 2       server . translate ’ Hello ’ , ’sv ’
 3
 4
 5   client sends :
 6       POST / translate
 7        Content - Type : application / json
 8       {
 9            text :  Hello  ,
10            language :  sv 
11       }


                                      1    server expects :
                                      2        app . post ’/ translate ’ , ( req , res ) -
                                      3              fun = ’ translate ’       # translate
                                      4              args = req . body         #  Hello  ,  sv 
                                      5              call fun , args           #  Hej 
                                      6
                                      7
                                      8    server sends :
                                      9         200 OK
                                     10         Content - Type : application / json
                                     11        {
                                     12             result :  Hej 
                                     13        }
RPC to REST
RPC to REST
RPC to REST
Look around you. It’s not just you.
Perspectives. Hypermedia vs REST
Klarna
Journey of an API




      envision
      spec
      mock
      serve
      consume
Serving uniform HTTP
serve: Webmachine
serve: JeSSE




               schema
Journey of an API




      envision
      spec
      mock
      serve
      consume
envision: RESTgraph
spec: RESTpi for machines
spec: RESTpi by humans for humans
mock: Apiary.io
consume: RESTit



      1 URI as the only runtime requirement
      Centered around resources
      Simplify representations
      Transfer Protocol Layer
      Hypermedia Layer
      Hooks
      Sugar
consume: RESTit


1   it ’ should enter the store and look around ’ , ( done ) -
2     re$ = RESTit (). re$
3     re$ ( ’ http :// starbucks . apiary . io ’)
4     . read ()
5     . callback ( err , resp ) -
6        return done err if err
7        resp [0]. statusCode . should . equal 200
8        done ()


                                   1   it ’ should see what can be done with orders ’ , ( done ) -
                                   2     re$ = RESTit (). re$
                                   3
                                   4     re$ ( ’ http :// starbucks . apiary . io ’)
                                   5     . read ()
                                   6     . follow ( ’/ rels / orders ’)
                                   7     . options ()
                                   8     . callback ( err , resp ) -
                                   9        return done err if err
                                  10        resp [0]. statusCode . should . equal 200
                                  11        resp [0]. canPOST . should . equal true
                                  12        should . not . equal resp [0]. canDELETE , true # undefined
                                  13        done ()
consume: RESTit

 1   it ’ should place an order and then update it ’ , ( done ) -
 2     re$ = RESTit (). re$
 3
 4     re$ ( ’ http :// starbucks . apiary . io ’)
 5     . read ()
 6     . follow ( ’/ rels / orders ’)
 7     . create ({ representation :{ drink : ’ espresso ’}})
 8     . fo llowLocation ()
 9     . read ()
10     . callback ( err , resp ) -
11        return done err if err
12        resp [0]. statusCode . should . equal 200
13        @ [0]. bookmarkAs ’ myOrder ’
14        changeMyMind ()
15
16     changeMyMind = () -
17       re$ ( ’ myOrder ’)
18       . update ({ representation :{ ammend_drink : ’ with cream ’}})
19       . callback ( err , resp ) -
20          return done err if err
21          return done ()
22          resp [0]. statusCode . should . equal 200
23          resp [0]. representation . get ( ’. drink ’). should . equal ’ espresso con panna ’
24          done ()
consume: RESTit




 1   it ’ should smuggle an order ’ , ( done ) -
 2     re$ = RESTit (). re$
 3
 4     re$ ( ’ myOrder ’)
 5     . go ( ’ smuggle ’ , { representation :{ drink : ’ latte ’}})
 6     . callback ( err , resp ) -
 7        return done err if err
 8        resp [0]. statusCode . should . equal 200
 9        resp [0]. representation . get ( ’. drink ’). should . equal ’ latte ’
10        done ()
tools
simpler, safer  more fun
KITT
 KISS
RPC to  Hypermedia
       REST
          

Concrete case on Payments API


       @andreineculau




December 3-4, 2012, APIdays.io
Credits




          Scott Brinker, Marketing Technology Landscape Supergraphic
          Adam DuVander/Programmable Web, 5000 APIs: Facebook, Google, Twitter are changing the
          web
          Google Trends: Architecture styles
          Simon Dongle, Good Morning 2012
          Alan Dean, HTTP/1.1 activity diagram
          Philipp Meier, Liberator
          Data-Driven Documents
          sigma.js

Mais conteúdo relacionado

Mais procurados

関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统yiditushe
 
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitetKubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitetPer Bernhardt
 
Introduction to chef framework
Introduction to chef frameworkIntroduction to chef framework
Introduction to chef frameworkmorgoth
 
Chef or how to make computers do the work for us
Chef or how to make computers do the work for usChef or how to make computers do the work for us
Chef or how to make computers do the work for ussickill
 
Application Layer in PHP
Application Layer in PHPApplication Layer in PHP
Application Layer in PHPPer Bernhardt
 
More to RoC weibo
More to RoC weiboMore to RoC weibo
More to RoC weiboshaokun
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @SilexJeen Lee
 
What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012D
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebookguoqing75
 
How to simplify OSGi development using OBR - Peter Kriens
How to simplify OSGi development using OBR - Peter KriensHow to simplify OSGi development using OBR - Peter Kriens
How to simplify OSGi development using OBR - Peter Kriensmfrancis
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发shaokun
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyondjimi-c
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scriptingTony Fabeen
 
Wykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w LaraveluWykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w LaraveluLaravel Poland MeetUp
 
Perl one-liners
Perl one-linersPerl one-liners
Perl one-linersdaoswald
 

Mais procurados (20)

関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
Facebook的缓存系统
Facebook的缓存系统Facebook的缓存系统
Facebook的缓存系统
 
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitetKubernetes: Wie Chefkoch.de mit Containern arbeitet
Kubernetes: Wie Chefkoch.de mit Containern arbeitet
 
Introduction to chef framework
Introduction to chef frameworkIntroduction to chef framework
Introduction to chef framework
 
Chef or how to make computers do the work for us
Chef or how to make computers do the work for usChef or how to make computers do the work for us
Chef or how to make computers do the work for us
 
SVN Hook
SVN HookSVN Hook
SVN Hook
 
Ajax basics
Ajax basicsAjax basics
Ajax basics
 
Application Layer in PHP
Application Layer in PHPApplication Layer in PHP
Application Layer in PHP
 
More to RoC weibo
More to RoC weiboMore to RoC weibo
More to RoC weibo
 
OWASP Proxy
OWASP ProxyOWASP Proxy
OWASP Proxy
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @Silex
 
What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012What mom never told you about bundle configurations - Symfony Live Paris 2012
What mom never told you about bundle configurations - Symfony Live Paris 2012
 
4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook4069180 Caching Performance Lessons From Facebook
4069180 Caching Performance Lessons From Facebook
 
How to simplify OSGi development using OBR - Peter Kriens
How to simplify OSGi development using OBR - Peter KriensHow to simplify OSGi development using OBR - Peter Kriens
How to simplify OSGi development using OBR - Peter Kriens
 
Server Side? Swift
Server Side? SwiftServer Side? Swift
Server Side? Swift
 
Rails web api 开发
Rails web api 开发Rails web api 开发
Rails web api 开发
 
V2 and beyond
V2 and beyondV2 and beyond
V2 and beyond
 
Devinsampa nginx-scripting
Devinsampa nginx-scriptingDevinsampa nginx-scripting
Devinsampa nginx-scripting
 
Wykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w LaraveluWykorzystanie form request przy implementacji API w Laravelu
Wykorzystanie form request przy implementacji API w Laravelu
 
Perl one-liners
Perl one-linersPerl one-liners
Perl one-liners
 

Semelhante a RPC to REST (Hypermedia)

node.js workshop- node.js basics
node.js workshop- node.js basicsnode.js workshop- node.js basics
node.js workshop- node.js basicsQiong Wu
 
1時間で作るマッシュアップサービス(関西版)
1時間で作るマッシュアップサービス(関西版)1時間で作るマッシュアップサービス(関西版)
1時間で作るマッシュアップサービス(関西版)Yuichiro MASUI
 
node.js workshop- node.js middleware
node.js workshop- node.js middlewarenode.js workshop- node.js middleware
node.js workshop- node.js middlewareQiong Wu
 
OSC2007-niigata - mashup
OSC2007-niigata - mashupOSC2007-niigata - mashup
OSC2007-niigata - mashupYuichiro MASUI
 
Server side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHPServer side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHPMarc Gear
 
From Ruby to Node.js
From Ruby to Node.jsFrom Ruby to Node.js
From Ruby to Node.jsjubilem
 
Implementing data sync apis for mibile apps @cloudconf
Implementing data sync apis for mibile apps @cloudconfImplementing data sync apis for mibile apps @cloudconf
Implementing data sync apis for mibile apps @cloudconfMichele Orselli
 
Real Time App with Node.js
Real Time App with Node.jsReal Time App with Node.js
Real Time App with Node.jsJxck Jxck
 
Real World React Native & ES7
Real World React Native & ES7Real World React Native & ES7
Real World React Native & ES7joestanton1
 
PSR-7, middlewares e o futuro dos frameworks
PSR-7, middlewares e o futuro dos frameworksPSR-7, middlewares e o futuro dos frameworks
PSR-7, middlewares e o futuro dos frameworksElton Minetto
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Sibelius Seraphini - Relay Modern
Sibelius Seraphini - Relay ModernSibelius Seraphini - Relay Modern
Sibelius Seraphini - Relay ModernReact Conf Brasil
 
Finch.io - Purely Functional REST API with Finagle
Finch.io - Purely Functional REST API with FinagleFinch.io - Purely Functional REST API with Finagle
Finch.io - Purely Functional REST API with FinagleVladimir Kostyukov
 
CouchDB : More Couch
CouchDB : More CouchCouchDB : More Couch
CouchDB : More Couchdelagoya
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasminePaulo Ragonha
 
Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Webnickmbailey
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryTatsuhiko Miyagawa
 
Everybody Polyglot! - Cross-Language RPC with Erlang
Everybody Polyglot! - Cross-Language RPC with ErlangEverybody Polyglot! - Cross-Language RPC with Erlang
Everybody Polyglot! - Cross-Language RPC with ErlangRusty Klophaus
 
Background Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitBackground Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitRedis Labs
 

Semelhante a RPC to REST (Hypermedia) (20)

node.js workshop- node.js basics
node.js workshop- node.js basicsnode.js workshop- node.js basics
node.js workshop- node.js basics
 
1時間で作るマッシュアップサービス(関西版)
1時間で作るマッシュアップサービス(関西版)1時間で作るマッシュアップサービス(関西版)
1時間で作るマッシュアップサービス(関西版)
 
node.js workshop- node.js middleware
node.js workshop- node.js middlewarenode.js workshop- node.js middleware
node.js workshop- node.js middleware
 
OSC2007-niigata - mashup
OSC2007-niigata - mashupOSC2007-niigata - mashup
OSC2007-niigata - mashup
 
Server side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHPServer side scripting smack down - Node.js vs PHP
Server side scripting smack down - Node.js vs PHP
 
From Ruby to Node.js
From Ruby to Node.jsFrom Ruby to Node.js
From Ruby to Node.js
 
Implementing data sync apis for mibile apps @cloudconf
Implementing data sync apis for mibile apps @cloudconfImplementing data sync apis for mibile apps @cloudconf
Implementing data sync apis for mibile apps @cloudconf
 
Real Time App with Node.js
Real Time App with Node.jsReal Time App with Node.js
Real Time App with Node.js
 
Real World React Native & ES7
Real World React Native & ES7Real World React Native & ES7
Real World React Native & ES7
 
PSR-7, middlewares e o futuro dos frameworks
PSR-7, middlewares e o futuro dos frameworksPSR-7, middlewares e o futuro dos frameworks
PSR-7, middlewares e o futuro dos frameworks
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Sibelius Seraphini - Relay Modern
Sibelius Seraphini - Relay ModernSibelius Seraphini - Relay Modern
Sibelius Seraphini - Relay Modern
 
Finch.io - Purely Functional REST API with Finagle
Finch.io - Purely Functional REST API with FinagleFinch.io - Purely Functional REST API with Finagle
Finch.io - Purely Functional REST API with Finagle
 
CouchDB : More Couch
CouchDB : More CouchCouchDB : More Couch
CouchDB : More Couch
 
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and JasmineSingle Page Web Applications with CoffeeScript, Backbone and Jasmine
Single Page Web Applications with CoffeeScript, Backbone and Jasmine
 
Clojure and the Web
Clojure and the WebClojure and the Web
Clojure and the Web
 
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQueryRemedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
 
Everybody Polyglot! - Cross-Language RPC with Erlang
Everybody Polyglot! - Cross-Language RPC with ErlangEverybody Polyglot! - Cross-Language RPC with Erlang
Everybody Polyglot! - Cross-Language RPC with Erlang
 
REST API for your WP7 App
REST API for your WP7 AppREST API for your WP7 App
REST API for your WP7 App
 
Background Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbitBackground Tasks in Node - Evan Tahler, TaskRabbit
Background Tasks in Node - Evan Tahler, TaskRabbit
 

Último

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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
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
 
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
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Último (20)

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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
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
 
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
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

RPC to REST (Hypermedia)

  • 1.
  • 2. RPC to Hypermedia REST Concrete case on Payments API @andreineculau
  • 3. RPC - Making a Remote Procedure Call 1 client imagines : 2 server . translate ’ Hello ’ , ’sv ’ 3 4 5 client sends : 6 POST / rpc 7 Content - Type : application / json 8 { 9 method : translate , 10 args : [ Hello , sv ] 11 } 1 server expects : 2 app . post ’/ rpc ’ , ( req , res ) - 3 fun = req . body . method # translate 4 args = req . body . args # Hello , sv 5 call fun , args # Hej 6 7 8 server sends : 9 200 OK 10 Content - Type : application / json 11 { 12 result : Hej 13 }
  • 4. REST - Making a HTTP request 1 client imagines : 2 server . translate ’ Hello ’ , ’sv ’ 3 4 5 client sends : 6 POST / translate 7 Content - Type : application / json 8 { 9 text : Hello , 10 language : sv 11 } 1 server expects : 2 app . post ’/ translate ’ , ( req , res ) - 3 fun = ’ translate ’ # translate 4 args = req . body # Hello , sv 5 call fun , args # Hej 6 7 8 server sends : 9 200 OK 10 Content - Type : application / json 11 { 12 result : Hej 13 }
  • 8. Look around you. It’s not just you.
  • 11. Journey of an API envision spec mock serve consume
  • 14. serve: JeSSE schema
  • 15.
  • 16. Journey of an API envision spec mock serve consume
  • 18. spec: RESTpi for machines
  • 19. spec: RESTpi by humans for humans
  • 21. consume: RESTit 1 URI as the only runtime requirement Centered around resources Simplify representations Transfer Protocol Layer Hypermedia Layer Hooks Sugar
  • 22. consume: RESTit 1 it ’ should enter the store and look around ’ , ( done ) - 2 re$ = RESTit (). re$ 3 re$ ( ’ http :// starbucks . apiary . io ’) 4 . read () 5 . callback ( err , resp ) - 6 return done err if err 7 resp [0]. statusCode . should . equal 200 8 done () 1 it ’ should see what can be done with orders ’ , ( done ) - 2 re$ = RESTit (). re$ 3 4 re$ ( ’ http :// starbucks . apiary . io ’) 5 . read () 6 . follow ( ’/ rels / orders ’) 7 . options () 8 . callback ( err , resp ) - 9 return done err if err 10 resp [0]. statusCode . should . equal 200 11 resp [0]. canPOST . should . equal true 12 should . not . equal resp [0]. canDELETE , true # undefined 13 done ()
  • 23. consume: RESTit 1 it ’ should place an order and then update it ’ , ( done ) - 2 re$ = RESTit (). re$ 3 4 re$ ( ’ http :// starbucks . apiary . io ’) 5 . read () 6 . follow ( ’/ rels / orders ’) 7 . create ({ representation :{ drink : ’ espresso ’}}) 8 . fo llowLocation () 9 . read () 10 . callback ( err , resp ) - 11 return done err if err 12 resp [0]. statusCode . should . equal 200 13 @ [0]. bookmarkAs ’ myOrder ’ 14 changeMyMind () 15 16 changeMyMind = () - 17 re$ ( ’ myOrder ’) 18 . update ({ representation :{ ammend_drink : ’ with cream ’}}) 19 . callback ( err , resp ) - 20 return done err if err 21 return done () 22 resp [0]. statusCode . should . equal 200 23 resp [0]. representation . get ( ’. drink ’). should . equal ’ espresso con panna ’ 24 done ()
  • 24. consume: RESTit 1 it ’ should smuggle an order ’ , ( done ) - 2 re$ = RESTit (). re$ 3 4 re$ ( ’ myOrder ’) 5 . go ( ’ smuggle ’ , { representation :{ drink : ’ latte ’}}) 6 . callback ( err , resp ) - 7 return done err if err 8 resp [0]. statusCode . should . equal 200 9 resp [0]. representation . get ( ’. drink ’). should . equal ’ latte ’ 10 done ()
  • 27. RPC to Hypermedia REST Concrete case on Payments API @andreineculau December 3-4, 2012, APIdays.io
  • 28. Credits Scott Brinker, Marketing Technology Landscape Supergraphic Adam DuVander/Programmable Web, 5000 APIs: Facebook, Google, Twitter are changing the web Google Trends: Architecture styles Simon Dongle, Good Morning 2012 Alan Dean, HTTP/1.1 activity diagram Philipp Meier, Liberator Data-Driven Documents sigma.js