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

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 

Recently uploaded (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 

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