SlideShare a Scribd company logo
1 of 51
A Conversation About REST
          Jeremy Brown
        notmessenger.com
What is an API?
What is an API?
From Wikipedia:

An application programming interface (API)
is a particular set of rules and specifications
that a software program can follow to access
and make use of the services and resources
provided by another software program that
implements the API.
What is an API?
Wikipedia continues:

It serves as an interface between different
software programs and facilitates their
interaction, similar to the way the user
interface facilitates interaction between
humans and computers.
What is an API?
Our understanding:

Set of rules and specifications to facilitate
the interaction between different software
programs.
Examples
mkdir

format
Types of APIs
XML-RPC (1998)

SOAP (1998, 2003)

JSON-RPC (2005)

REST (2000)
XML-RPC
xmlrpc.com

It’s remote procedure calling using HTTP as
the transport and XML as the encoding.
XML-RPC is designed to be as simple as
possible, while allowing complex data
structures to be transmitted, processed and
returned.
XML-RPC
xmlrpc.com also says:
We wanted a clean, extensible format that’s very
simple. It should be possible for an HTML coder to
be able to look at a file containing an XML-RPC
call, understand what it’s doing, and be able to
modify it and have it work on the first or second
try... We also wanted it to be an easy protocol
that could quickly be adapted to run in other
environments or on other operating systems.
XML-RPC
Sample Request:
<?xml version="1.0"?>
<methodCall>
  <methodName>getStateName</methodName>
  <params>
    <param>
        <value><int>40</int></value>
    </param>
  </params>
</methodCall>
XML-RPC
Sample Request:
<?xml version="1.0"?>
<methodCall>
  <methodName>getStateName</methodName>
  <params>
    <param>
        <value><int>40</int></value>
    </param>
  </params>
</methodCall>



Sample Response:
<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
        <value><string>South Dakota</string></value>
    </param>
  </params>
</methodResponse>
SOAP
SOAP spec:
SOAP is a lightweight protocol for exchange of
information in a decentralized, distributed
environment. It is an XML based protocol that
consists of three parts: an envelope that defines a
framework for describing what is in a message and
how to process it, a set of encoding rules for
expressing instances of application-defined datatypes,
and a convention for representing remote procedure
calls and responses.
SOAP
Sample Request:
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 299

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Header>
  </soap:Header>
  <soap:Body>
    <m:GetStockPrice xmlns:m="http://www.example.org/stock">
      <m:StockName>IBM</m:StockName>
    </m:GetStockPrice>
  </soap:Body>
</soap:Envelope>
JSON-RPC
Wikipedia says:

JSON-RPC is a remote procedure call
protocol encoded in JSON. It is a very simple
protocol (and very similar to XML-RPC),
defining only a handful of data types and
commands.
JSON-RPC
Sample Request:
{
"version": "1.1",
"method": "confirmFruitPurchase",
"id": "194521489",
"params": [
    [ "apple", "orange", "pear" ],
    1.123
]
}




{
"version": "1.1",
"result": "done",
"error": null,
"id": "194521489"
}
JSON-RPC
Sample Request:
{
"version": "1.1",
"method": "confirmFruitPurchase",
"id": "194521489",
"params": [
    [ "apple", "orange", "pear" ],
    1.123
]
}



Sample Response:
{
"version": "1.1",
"result": "done",
"error": null,
"id": "194521489"
}
Types of APIs
Types of APIs
XML-RPC

SOAP

JSON-RPC
Types of APIs
XML-RPC

SOAP          Service Oriented
JSON-RPC
Types of APIs
XML-RPC

SOAP          Service Oriented
JSON-RPC

REST          Resource Oriented
Types of APIs
   XML-RPC

   SOAP               Service Oriented
   JSON-RPC

   REST                Resource Oriented

Service Oriented architectures are designed
to call methods. REST transports resources.
REST
Representational State Transfer
Guiding Principles
Identification of resources

Manipulation of resources through these
representations

Self-descriptive messages

Hypermedia as the Engine of Application
State (HATEOAS)
Identification of resources
  Individual resources are identified in
  requests, for example using URIs in web-
  based REST systems
Identification of resources
  Individual resources are identified in
  requests, for example using URIs in web-
  based REST systems

  http://api.myapi.com/articles
Identification of resources
  Individual resources are identified in
  requests, for example using URIs in web-
  based REST systems

  http://api.myapi.com/articles
  http://api.myapi.com/article/12
Identification of resources
  Individual resources are identified in
  requests, for example using URIs in web-
  based REST systems

  http://api.myapi.com/articles
  http://api.myapi.com/article/12
  http://api.myapi.com/customer/4/order/18
Manipulation of resources
Manipulation of resources
  GET

  Return representation of the resource
  requested
Manipulation of resources
  GET

  Return representation of the resource
  requested

  PUT

  Replace representation with new
  representation, or create if does not exist
Manipulation of resources
Manipulation of resources
  POST

  Create a new resource
Manipulation of resources
  POST

  Create a new resource

  DELETE

  Delete the resource
Self-descriptive messages
 Each message includes enough information to
 describe how to process the message

 For example, the specification of media type
 through the use of the Content-Type header
Self-descriptive messages
   Each message includes enough information to
   describe how to process the message

   For example, the specification of media type
   through the use of the Content-Type header

Content-Type: image/jpeg
Self-descriptive messages
    Each message includes enough information to
    describe how to process the message

    For example, the specification of media type
    through the use of the Content-Type header

Content-Type: image/jpeg

                                  <radius>2</radius>
Content-Type: application/xml     <unit>inches</unit>
Self-descriptive messages
Another example are the Response Codes:
   200 Okay               413 Request Entity Too Large

   201 Created            415 Unsupported Media Type

   303 See Other          416 Requested Range Not Satisfiable

   401 Unauthorized       501 Not Implemented

   404 Not Found          many others
HATEOAS
HATEOAS
Just like with HTTP, there is no maintenance
of application state.
HATEOAS
Just like with HTTP, there is no maintenance
of application state.

Cookies are bad! Very, very bad!!
HATEOAS
Just like with HTTP, there is no maintenance
of application state.

Cookies are bad! Very, very bad!!

Related URIs should be included in
representations of resources.
Live Examples!
Other ways to interact
 with a REST service
Other ways to interact
 with a REST service
OPTIONS

Discover which methods of manipulation are
available for specified resource
Other ways to interact
 with a REST service
OPTIONS

Discover which methods of manipulation are
available for specified resource

HEAD

Get sample of Response header without data
payload
Conversation Starters
REST is a set of principles
 and not a specification
Allow for differing Accept
 and Content-Type values
 Content-Type: application/xml

 Accept: text/javascript
http://www.aisee.com/graph_of_the_month/http.png
Thank You
  Jeremy Brown
notmessenger.com

More Related Content

What's hot

Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Paul Jones
 
The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)Paul Jones
 
.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3aminmesbahi
 
Rails vs Web2py
Rails vs Web2pyRails vs Web2py
Rails vs Web2pyjonromero
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHPZoran Jeremic
 
Ajp notes-chapter-06
Ajp notes-chapter-06Ajp notes-chapter-06
Ajp notes-chapter-06Ankit Dubey
 
Php Interview Questions
Php Interview QuestionsPhp Interview Questions
Php Interview QuestionsUmeshSingh159
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platformNelson Kopliku
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentationyamcsha
 
Action-Domain-Responder: A Refinement of MVC
Action-Domain-Responder: A Refinement of MVCAction-Domain-Responder: A Refinement of MVC
Action-Domain-Responder: A Refinement of MVCPaul Jones
 
Server-side Technologies in Java
Server-side Technologies in JavaServer-side Technologies in Java
Server-side Technologies in JavaAnirban Majumdar
 
ILUG 2007 - Notes and Office Integration
ILUG 2007 - Notes and Office IntegrationILUG 2007 - Notes and Office Integration
ILUG 2007 - Notes and Office IntegrationJohn Head
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and DjangoMichael Pirnat
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorialsunniboy
 
Test in Rest. API testing with the help of Rest Assured.
Test in Rest. API testing with the help of  Rest Assured.Test in Rest. API testing with the help of  Rest Assured.
Test in Rest. API testing with the help of Rest Assured.Artem Korchevyi
 

What's hot (19)

Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)Organinzing Your PHP Projects (2010 Memphis PHP)
Organinzing Your PHP Projects (2010 Memphis PHP)
 
The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)The Solar Framework for PHP 5 (2010 Confoo)
The Solar Framework for PHP 5 (2010 Confoo)
 
.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3
 
Rails vs Web2py
Rails vs Web2pyRails vs Web2py
Rails vs Web2py
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
 
Ajp notes-chapter-06
Ajp notes-chapter-06Ajp notes-chapter-06
Ajp notes-chapter-06
 
Php Interview Questions
Php Interview QuestionsPhp Interview Questions
Php Interview Questions
 
Java servlets and CGI
Java servlets and CGIJava servlets and CGI
Java servlets and CGI
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platform
 
Zend Framework
Zend FrameworkZend Framework
Zend Framework
 
Zend Framework 2 - presentation
Zend Framework 2 - presentationZend Framework 2 - presentation
Zend Framework 2 - presentation
 
Action-Domain-Responder: A Refinement of MVC
Action-Domain-Responder: A Refinement of MVCAction-Domain-Responder: A Refinement of MVC
Action-Domain-Responder: A Refinement of MVC
 
Server-side Technologies in Java
Server-side Technologies in JavaServer-side Technologies in Java
Server-side Technologies in Java
 
ILUG 2007 - Notes and Office Integration
ILUG 2007 - Notes and Office IntegrationILUG 2007 - Notes and Office Integration
ILUG 2007 - Notes and Office Integration
 
Common Gateway Interface ppt
Common Gateway Interface pptCommon Gateway Interface ppt
Common Gateway Interface ppt
 
Web Development with Python and Django
Web Development with Python and DjangoWeb Development with Python and Django
Web Development with Python and Django
 
Ruby On Rails Tutorial
Ruby On Rails TutorialRuby On Rails Tutorial
Ruby On Rails Tutorial
 
Test in Rest. API testing with the help of Rest Assured.
Test in Rest. API testing with the help of  Rest Assured.Test in Rest. API testing with the help of  Rest Assured.
Test in Rest. API testing with the help of Rest Assured.
 
Maven
MavenMaven
Maven
 

Viewers also liked

Best Practices for Nonprofit Fraud and Embezzlement Prevention
Best Practices for Nonprofit Fraud and Embezzlement PreventionBest Practices for Nonprofit Fraud and Embezzlement Prevention
Best Practices for Nonprofit Fraud and Embezzlement PreventionPerkins Law, PLLC
 
Creating new service name for oracle database
Creating new service name for oracle databaseCreating new service name for oracle database
Creating new service name for oracle databaseRavi Kumar Lanke
 
Preparing Your Data for an Affirmative Action Plan: Promotions
Preparing Your Data for an Affirmative Action Plan: PromotionsPreparing Your Data for an Affirmative Action Plan: Promotions
Preparing Your Data for an Affirmative Action Plan: PromotionsThomas Econometrics
 
201608 Opensource, Moodle, and Education
201608 Opensource, Moodle, and Education201608 Opensource, Moodle, and Education
201608 Opensource, Moodle, and Educationwon ho
 
Sedaj tudi Facebook s svojo "trgovino" aplikacij._Marketing Magazin_jun2012_s...
Sedaj tudi Facebook s svojo "trgovino" aplikacij._Marketing Magazin_jun2012_s...Sedaj tudi Facebook s svojo "trgovino" aplikacij._Marketing Magazin_jun2012_s...
Sedaj tudi Facebook s svojo "trgovino" aplikacij._Marketing Magazin_jun2012_s...Urska Saletinger
 
W.K. Kellogg Foundation - Workforce Composition (2011)
W.K. Kellogg Foundation - Workforce Composition (2011)W.K. Kellogg Foundation - Workforce Composition (2011)
W.K. Kellogg Foundation - Workforce Composition (2011)W.K. Kellogg Foundation
 
QPWB Default Services E-Brochure
QPWB Default Services E-BrochureQPWB Default Services E-Brochure
QPWB Default Services E-Brochuremjbarker
 
ANU Library: responding to new needs
ANU Library: responding to new needsANU Library: responding to new needs
ANU Library: responding to new needsRoxanne Missingham
 
Building personas
Building personasBuilding personas
Building personasElaine Chen
 
SS7/Sigtran Applications ( HLR, EIR, INSCP, USSD, SMSC etc)
SS7/Sigtran Applications  ( HLR, EIR, INSCP, USSD, SMSC etc)SS7/Sigtran Applications  ( HLR, EIR, INSCP, USSD, SMSC etc)
SS7/Sigtran Applications ( HLR, EIR, INSCP, USSD, SMSC etc)rajlibran2001
 
游戏运营(第四讲)
游戏运营(第四讲)游戏运营(第四讲)
游戏运营(第四讲)www.emean.com
 
Portfolio Presentation
Portfolio PresentationPortfolio Presentation
Portfolio Presentationdjmmm
 
SaaS Studies - SaaS Directories
SaaS Studies - SaaS DirectoriesSaaS Studies - SaaS Directories
SaaS Studies - SaaS DirectoriesSonny Brabez
 

Viewers also liked (20)

Best Practices for Nonprofit Fraud and Embezzlement Prevention
Best Practices for Nonprofit Fraud and Embezzlement PreventionBest Practices for Nonprofit Fraud and Embezzlement Prevention
Best Practices for Nonprofit Fraud and Embezzlement Prevention
 
F O T O S I N T E S I S - dhita
F O T O S I N T E S I S - dhitaF O T O S I N T E S I S - dhita
F O T O S I N T E S I S - dhita
 
1.1a rasional pengembangan k2013
1.1a    rasional pengembangan k20131.1a    rasional pengembangan k2013
1.1a rasional pengembangan k2013
 
Creating new service name for oracle database
Creating new service name for oracle databaseCreating new service name for oracle database
Creating new service name for oracle database
 
Preparing Your Data for an Affirmative Action Plan: Promotions
Preparing Your Data for an Affirmative Action Plan: PromotionsPreparing Your Data for an Affirmative Action Plan: Promotions
Preparing Your Data for an Affirmative Action Plan: Promotions
 
201608 Opensource, Moodle, and Education
201608 Opensource, Moodle, and Education201608 Opensource, Moodle, and Education
201608 Opensource, Moodle, and Education
 
Structureel verbeteren en borgen van de installatie
Structureel verbeteren en borgen van de installatieStructureel verbeteren en borgen van de installatie
Structureel verbeteren en borgen van de installatie
 
Sedaj tudi Facebook s svojo "trgovino" aplikacij._Marketing Magazin_jun2012_s...
Sedaj tudi Facebook s svojo "trgovino" aplikacij._Marketing Magazin_jun2012_s...Sedaj tudi Facebook s svojo "trgovino" aplikacij._Marketing Magazin_jun2012_s...
Sedaj tudi Facebook s svojo "trgovino" aplikacij._Marketing Magazin_jun2012_s...
 
W.K. Kellogg Foundation - Workforce Composition (2011)
W.K. Kellogg Foundation - Workforce Composition (2011)W.K. Kellogg Foundation - Workforce Composition (2011)
W.K. Kellogg Foundation - Workforce Composition (2011)
 
QPWB Default Services E-Brochure
QPWB Default Services E-BrochureQPWB Default Services E-Brochure
QPWB Default Services E-Brochure
 
ANU Library: responding to new needs
ANU Library: responding to new needsANU Library: responding to new needs
ANU Library: responding to new needs
 
Verduurzamen?Verduurzamen!
Verduurzamen?Verduurzamen!Verduurzamen?Verduurzamen!
Verduurzamen?Verduurzamen!
 
Building personas
Building personasBuilding personas
Building personas
 
SS7/Sigtran Applications ( HLR, EIR, INSCP, USSD, SMSC etc)
SS7/Sigtran Applications  ( HLR, EIR, INSCP, USSD, SMSC etc)SS7/Sigtran Applications  ( HLR, EIR, INSCP, USSD, SMSC etc)
SS7/Sigtran Applications ( HLR, EIR, INSCP, USSD, SMSC etc)
 
游戏运营(第四讲)
游戏运营(第四讲)游戏运营(第四讲)
游戏运营(第四讲)
 
Portfolio Presentation
Portfolio PresentationPortfolio Presentation
Portfolio Presentation
 
Iran iraq
Iran iraqIran iraq
Iran iraq
 
SaaS Studies - SaaS Directories
SaaS Studies - SaaS DirectoriesSaaS Studies - SaaS Directories
SaaS Studies - SaaS Directories
 
hombre
hombrehombre
hombre
 
Hoe gaan zorginstellingen om met het energievraagstuk?
Hoe gaan zorginstellingen om met het energievraagstuk?Hoe gaan zorginstellingen om met het energievraagstuk?
Hoe gaan zorginstellingen om met het energievraagstuk?
 

Similar to A Conversation About REST

A Conversation About REST - Extended Version
A Conversation About REST - Extended VersionA Conversation About REST - Extended Version
A Conversation About REST - Extended VersionJeremy Brown
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Jackson F. de A. Mafra
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJerry Kurian
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful FundamentalsSuresh Madhra
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful FundamentalsSuresh Madhra
 
Network Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyNetwork Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyPayal Jain
 
Api design and development
Api design and developmentApi design and development
Api design and developmentoquidave
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座Li Yi
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural StyleRobert Wilson
 
Best practices and advantages of REST APIs
Best practices and advantages of REST APIsBest practices and advantages of REST APIs
Best practices and advantages of REST APIsAparna Sharma
 
Building Restful Applications Using Php
Building Restful Applications Using PhpBuilding Restful Applications Using Php
Building Restful Applications Using PhpSudheer Satyanarayana
 
RESTful services
RESTful servicesRESTful services
RESTful servicesgouthamrv
 

Similar to A Conversation About REST (20)

A Conversation About REST - Extended Version
A Conversation About REST - Extended VersionA Conversation About REST - Extended Version
A Conversation About REST - Extended Version
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
 
Apitesting.pptx
Apitesting.pptxApitesting.pptx
Apitesting.pptx
 
Salesforce REST API
Salesforce  REST API Salesforce  REST API
Salesforce REST API
 
JAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with JavaJAX-RS. Developing RESTful APIs with Java
JAX-RS. Developing RESTful APIs with Java
 
Rest web service
Rest web serviceRest web service
Rest web service
 
WebApp #3 : API
WebApp #3 : APIWebApp #3 : API
WebApp #3 : API
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
 
Web Service
Web ServiceWeb Service
Web Service
 
Network Device Database Management with REST using Jersey
Network Device Database Management with REST using JerseyNetwork Device Database Management with REST using Jersey
Network Device Database Management with REST using Jersey
 
Api design and development
Api design and developmentApi design and development
Api design and development
 
SFDC REST API
SFDC REST APISFDC REST API
SFDC REST API
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural Style
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Best practices and advantages of REST APIs
Best practices and advantages of REST APIsBest practices and advantages of REST APIs
Best practices and advantages of REST APIs
 
Building Restful Applications Using Php
Building Restful Applications Using PhpBuilding Restful Applications Using Php
Building Restful Applications Using Php
 
RESTful services
RESTful servicesRESTful services
RESTful services
 

Recently uploaded

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
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
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: 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
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Recently uploaded (20)

Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
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
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: 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.
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

A Conversation About REST

  • 1. A Conversation About REST Jeremy Brown notmessenger.com
  • 2. What is an API?
  • 3. What is an API? From Wikipedia: An application programming interface (API) is a particular set of rules and specifications that a software program can follow to access and make use of the services and resources provided by another software program that implements the API.
  • 4. What is an API? Wikipedia continues: It serves as an interface between different software programs and facilitates their interaction, similar to the way the user interface facilitates interaction between humans and computers.
  • 5. What is an API? Our understanding: Set of rules and specifications to facilitate the interaction between different software programs.
  • 7. Types of APIs XML-RPC (1998) SOAP (1998, 2003) JSON-RPC (2005) REST (2000)
  • 8. XML-RPC xmlrpc.com It’s remote procedure calling using HTTP as the transport and XML as the encoding. XML-RPC is designed to be as simple as possible, while allowing complex data structures to be transmitted, processed and returned.
  • 9. XML-RPC xmlrpc.com also says: We wanted a clean, extensible format that’s very simple. It should be possible for an HTML coder to be able to look at a file containing an XML-RPC call, understand what it’s doing, and be able to modify it and have it work on the first or second try... We also wanted it to be an easy protocol that could quickly be adapted to run in other environments or on other operating systems.
  • 10. XML-RPC Sample Request: <?xml version="1.0"?> <methodCall> <methodName>getStateName</methodName> <params> <param> <value><int>40</int></value> </param> </params> </methodCall>
  • 11. XML-RPC Sample Request: <?xml version="1.0"?> <methodCall> <methodName>getStateName</methodName> <params> <param> <value><int>40</int></value> </param> </params> </methodCall> Sample Response: <?xml version="1.0"?> <methodResponse> <params> <param> <value><string>South Dakota</string></value> </param> </params> </methodResponse>
  • 12. SOAP SOAP spec: SOAP is a lightweight protocol for exchange of information in a decentralized, distributed environment. It is an XML based protocol that consists of three parts: an envelope that defines a framework for describing what is in a message and how to process it, a set of encoding rules for expressing instances of application-defined datatypes, and a convention for representing remote procedure calls and responses.
  • 13. SOAP Sample Request: POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: 299 <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Header> </soap:Header> <soap:Body> <m:GetStockPrice xmlns:m="http://www.example.org/stock"> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope>
  • 14. JSON-RPC Wikipedia says: JSON-RPC is a remote procedure call protocol encoded in JSON. It is a very simple protocol (and very similar to XML-RPC), defining only a handful of data types and commands.
  • 15. JSON-RPC Sample Request: { "version": "1.1", "method": "confirmFruitPurchase", "id": "194521489", "params": [ [ "apple", "orange", "pear" ], 1.123 ] } { "version": "1.1", "result": "done", "error": null, "id": "194521489" }
  • 16. JSON-RPC Sample Request: { "version": "1.1", "method": "confirmFruitPurchase", "id": "194521489", "params": [ [ "apple", "orange", "pear" ], 1.123 ] } Sample Response: { "version": "1.1", "result": "done", "error": null, "id": "194521489" }
  • 19. Types of APIs XML-RPC SOAP Service Oriented JSON-RPC
  • 20. Types of APIs XML-RPC SOAP Service Oriented JSON-RPC REST Resource Oriented
  • 21. Types of APIs XML-RPC SOAP Service Oriented JSON-RPC REST Resource Oriented Service Oriented architectures are designed to call methods. REST transports resources.
  • 23. Guiding Principles Identification of resources Manipulation of resources through these representations Self-descriptive messages Hypermedia as the Engine of Application State (HATEOAS)
  • 24. Identification of resources Individual resources are identified in requests, for example using URIs in web- based REST systems
  • 25. Identification of resources Individual resources are identified in requests, for example using URIs in web- based REST systems http://api.myapi.com/articles
  • 26. Identification of resources Individual resources are identified in requests, for example using URIs in web- based REST systems http://api.myapi.com/articles http://api.myapi.com/article/12
  • 27. Identification of resources Individual resources are identified in requests, for example using URIs in web- based REST systems http://api.myapi.com/articles http://api.myapi.com/article/12 http://api.myapi.com/customer/4/order/18
  • 29. Manipulation of resources GET Return representation of the resource requested
  • 30. Manipulation of resources GET Return representation of the resource requested PUT Replace representation with new representation, or create if does not exist
  • 32. Manipulation of resources POST Create a new resource
  • 33. Manipulation of resources POST Create a new resource DELETE Delete the resource
  • 34. Self-descriptive messages Each message includes enough information to describe how to process the message For example, the specification of media type through the use of the Content-Type header
  • 35. Self-descriptive messages Each message includes enough information to describe how to process the message For example, the specification of media type through the use of the Content-Type header Content-Type: image/jpeg
  • 36. Self-descriptive messages Each message includes enough information to describe how to process the message For example, the specification of media type through the use of the Content-Type header Content-Type: image/jpeg <radius>2</radius> Content-Type: application/xml <unit>inches</unit>
  • 37. Self-descriptive messages Another example are the Response Codes: 200 Okay 413 Request Entity Too Large 201 Created 415 Unsupported Media Type 303 See Other 416 Requested Range Not Satisfiable 401 Unauthorized 501 Not Implemented 404 Not Found many others
  • 39. HATEOAS Just like with HTTP, there is no maintenance of application state.
  • 40. HATEOAS Just like with HTTP, there is no maintenance of application state. Cookies are bad! Very, very bad!!
  • 41. HATEOAS Just like with HTTP, there is no maintenance of application state. Cookies are bad! Very, very bad!! Related URIs should be included in representations of resources.
  • 42.
  • 44. Other ways to interact with a REST service
  • 45. Other ways to interact with a REST service OPTIONS Discover which methods of manipulation are available for specified resource
  • 46. Other ways to interact with a REST service OPTIONS Discover which methods of manipulation are available for specified resource HEAD Get sample of Response header without data payload
  • 48. REST is a set of principles and not a specification
  • 49. Allow for differing Accept and Content-Type values Content-Type: application/xml Accept: text/javascript
  • 51. Thank You Jeremy Brown notmessenger.com

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. SOAP - 2003: W3C recommendation submitted. Is NOT a spec.\n
  7. \n
  8. \n
  9. \n
  10. \n
  11. Can be used over SMTP and other protocols because of its design.\n\nIs NOT lightweight.\n\nNothing works out of the box - ever.\n
  12. \n
  13. \n
  14. Required Methods\n\nREQUEST:\n method\n id\n params\n\nRESPONSE:\n result\n error\n id\n
  15. \n
  16. \n
  17. \n
  18. \n
  19. Roy Fielding\n\nCo-authored HTTP 1.0 and 1.1 spec\n\nREST was designed along side HTTP 1.1\n
  20. \n
  21. 1st one: talk about collections\n\n3rd one: talk about customer/order vs order/customer\n
  22. 1st one: talk about collections\n\n3rd one: talk about customer/order vs order/customer\n
  23. 1st one: talk about collections\n\n3rd one: talk about customer/order vs order/customer\n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. Statler and Waldorf\n
  36. Statler and Waldorf\n
  37. \n
  38. \n
  39. \n
  40. Remember PUT? Not all APIs create a new resource.\n
  41. \n
  42. \n
  43. \n